Class: InlineSvg::TransformPipeline::Transformations::NoComment

Inherits:
Transformation
  • Object
show all
Defined in:
lib/inline_svg/transform_pipeline/transformations/no_comment.rb

Instance Attribute Summary

Attributes inherited from Transformation

#value

Instance Method Summary collapse

Methods inherited from Transformation

create_with_value, #initialize

Constructor Details

This class inherits a constructor from InlineSvg::TransformPipeline::Transformations::Transformation

Instance Method Details

#transform(doc) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/inline_svg/transform_pipeline/transformations/no_comment.rb', line 4

def transform(doc)
  doc = Nokogiri::XML::Document.parse(doc.to_html)
  doc.xpath("//comment()").each do |comment|
    comment.remove
  end
  doc
end