18F/identity-dashboard

View on GitHub
app/models/validating_svg.rb

Summary

Maintainability
A
0 mins
Test Coverage
class ValidatingSvg
  attr_reader :svg

  def initialize(string_buffer)
    @svg = Nokogiri::XML(string_buffer)
  end

  def has_size_attribute?
    has_viewbox?
  end

  def has_script_tag?
    svg.css('script').present?
  end

  def has_viewbox?
    svg.css(':root[viewBox]').present?
  end
end