Class: Postsvg::Svg::Elements::Defs

Inherits:
Postsvg::Svg::Element show all
Defined in:
lib/postsvg/svg/elements/defs.rb

Constant Summary collapse

ELEMENT_NAME =
"defs"

Constants inherited from Postsvg::Svg::Element

Postsvg::Svg::Element::REGISTRY

Instance Attribute Summary collapse

Attributes inherited from Postsvg::Svg::Element

#attributes, #clip_path_id, #fill, #stroke, #stroke_paint, #transform

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postsvg::Svg::Element

#default_fill, #element_name, register, registry

Constructor Details

#initialize(children: [], **rest) ⇒ Defs

Returns a new instance of Defs.



12
13
14
15
# File 'lib/postsvg/svg/elements/defs.rb', line 12

def initialize(children: [], **rest)
  super(**rest)
  @children = children.freeze
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



10
11
12
# File 'lib/postsvg/svg/elements/defs.rb', line 10

def children
  @children
end

Class Method Details

.from_node(node) ⇒ Object



17
18
19
20
# File 'lib/postsvg/svg/elements/defs.rb', line 17

def self.from_node(node)
  new(children: node.element_children.map { |c| Element.from_node(c) },
      attributes: Elements.node_attributes(node))
end