Module: Emfsvg::Svg::Elements::Stylable

Defined in:
lib/emfsvg/svg/elements/stylable.rb

Overview

Common presentation attribute parsing shared by every shape. Module function — call as Stylable.parse_style(node) from an Element subclass's .from_node factory.

Class Method Summary collapse

Class Method Details

.parse_style(node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/emfsvg/svg/elements/stylable.rb', line 12

def parse_style(node)
  {
    fill: Svg::Paint.from_fill(node["fill"]),
    stroke: Svg::Stroke.parse(
      stroke: node["stroke"],
      width: node["stroke-width"],
      dash_array: node["stroke-dasharray"],
      line_cap: node["stroke-linecap"],
      line_join: node["stroke-linejoin"]
    ),
    clip_path: node["clip-path"]
  }
end