Class: InlineSvg::TransformPipeline::Transformations::Description
- Inherits:
-
Transformation
- Object
- Transformation
- InlineSvg::TransformPipeline::Transformations::Description
- Defined in:
- lib/inline_svg/transform_pipeline/transformations/description.rb
Instance Attribute Summary
Attributes inherited from Transformation
Instance Method Summary collapse
Methods inherited from Transformation
create_with_value, #initialize, #with_svg
Constructor Details
This class inherits a constructor from InlineSvg::TransformPipeline::Transformations::Transformation
Instance Method Details
#transform(doc) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/inline_svg/transform_pipeline/transformations/description.rb', line 3 def transform(doc) with_svg(doc) do |svg| node = Nokogiri::XML::Node.new("desc", doc) node.content = value svg.search("desc").each { |node| node.remove } svg.prepend_child(node) end end |