Class: Postsvg::Svg::Elements::ClipPath

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

Constant Summary collapse

ELEMENT_NAME =
"clipPath"

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(id:, children: [], **rest) ⇒ ClipPath

Returns a new instance of ClipPath.



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

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

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



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

def children
  @children
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Class Method Details

.from_node(node) ⇒ Object



18
19
20
21
22
# File 'lib/postsvg/svg/elements/clip_path.rb', line 18

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