Class: Postsvg::Svg::Elements::Path
- Inherits:
-
Postsvg::Svg::Element
- Object
- Postsvg::Svg::Element
- Postsvg::Svg::Elements::Path
- Defined in:
- lib/postsvg/svg/elements/path.rb
Constant Summary collapse
- ELEMENT_NAME =
"path"
Constants inherited from Postsvg::Svg::Element
Postsvg::Svg::Element::REGISTRY
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#fill ⇒ Object
readonly
Returns the value of attribute fill.
-
#stroke ⇒ Object
readonly
Returns the value of attribute stroke.
-
#stroke_paint ⇒ Object
readonly
Returns the value of attribute stroke_paint.
Attributes inherited from Postsvg::Svg::Element
#attributes, #children, #clip_path_id, #transform
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(commands:, fill:, stroke_paint:, stroke:, **rest) ⇒ Path
constructor
A new instance of Path.
Methods inherited from Postsvg::Svg::Element
#default_fill, #element_name, register, registry
Constructor Details
#initialize(commands:, fill:, stroke_paint:, stroke:, **rest) ⇒ Path
Returns a new instance of Path.
12 13 14 15 16 17 18 |
# File 'lib/postsvg/svg/elements/path.rb', line 12 def initialize(commands:, fill:, stroke_paint:, stroke:, **rest) super(**rest) @commands = commands.freeze @fill = fill @stroke_paint = stroke_paint @stroke = stroke end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
10 11 12 |
# File 'lib/postsvg/svg/elements/path.rb', line 10 def commands @commands end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
10 11 12 |
# File 'lib/postsvg/svg/elements/path.rb', line 10 def fill @fill end |
#stroke ⇒ Object (readonly)
Returns the value of attribute stroke.
10 11 12 |
# File 'lib/postsvg/svg/elements/path.rb', line 10 def stroke @stroke end |
#stroke_paint ⇒ Object (readonly)
Returns the value of attribute stroke_paint.
10 11 12 |
# File 'lib/postsvg/svg/elements/path.rb', line 10 def stroke_paint @stroke_paint end |
Class Method Details
.from_node(node) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/postsvg/svg/elements/path.rb', line 20 def self.from_node(node) new(commands: PathData.parse(node["d"]), fill: Paint.parse(node["fill"]), stroke_paint: Paint.parse(node["stroke"]), stroke: Stroke.parse(node), transform: TransformList.parse(node["transform"]), clip_path_id: Elements.parse_clip_path_id(node["clip-path"]), attributes: Elements.node_attributes(node)) end |