Class: Emfsvg::Svg::Elements::Path

Inherits:
Emfsvg::Svg::Element show all
Defined in:
lib/emfsvg/svg/elements/path.rb

Overview

. Stores parsed PathData::Command list.

Constant Summary collapse

ELEMENT_NAME =
"path"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Emfsvg::Svg::Element

#children, #element_name, register

Constructor Details

#initialize(commands:, fill:, stroke:, clip_path: nil) ⇒ Path

Returns a new instance of Path.



13
14
15
16
17
18
# File 'lib/emfsvg/svg/elements/path.rb', line 13

def initialize(commands:, fill:, stroke:, clip_path: nil)
  @commands = commands
  @fill = fill
  @stroke = stroke
  @clip_path = clip_path
end

Instance Attribute Details

#clip_pathObject (readonly)

Returns the value of attribute clip_path.



11
12
13
# File 'lib/emfsvg/svg/elements/path.rb', line 11

def clip_path
  @clip_path
end

#commandsObject (readonly)

Returns the value of attribute commands.



11
12
13
# File 'lib/emfsvg/svg/elements/path.rb', line 11

def commands
  @commands
end

#fillObject (readonly)

Returns the value of attribute fill.



11
12
13
# File 'lib/emfsvg/svg/elements/path.rb', line 11

def fill
  @fill
end

#strokeObject (readonly)

Returns the value of attribute stroke.



11
12
13
# File 'lib/emfsvg/svg/elements/path.rb', line 11

def stroke
  @stroke
end

Class Method Details

.from_node(node) ⇒ Object



20
21
22
23
24
25
# File 'lib/emfsvg/svg/elements/path.rb', line 20

def self.from_node(node)
  new(
    commands: Svg::PathData::Parser.parse(node["d"]),
    **Stylable.parse_style(node)
  )
end