Class: GridGenerator::Svg::Path
- Inherits:
-
Object
- Object
- GridGenerator::Svg::Path
- Defined in:
- lib/grid_generator/svg/path.rb
Instance Attribute Summary collapse
-
#d ⇒ Object
readonly
Returns the value of attribute d.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(d:, style:) ⇒ Path
constructor
A new instance of Path.
- #to_svg ⇒ Object
Constructor Details
#initialize(d:, style:) ⇒ Path
Returns a new instance of Path.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/grid_generator/svg/path.rb', line 4 def initialize(d: , style:) @d = case d when String d when Array d.map(&:to_s).join(' ') else raise ArgumentError, "d must be String or Array" end @style = case style when GridGenerator::Svg::Style style.to_s when String style else raise ArgumentError, "style must be String or Style" end end |
Instance Attribute Details
#d ⇒ Object (readonly)
Returns the value of attribute d.
23 24 25 |
# File 'lib/grid_generator/svg/path.rb', line 23 def d @d end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
23 24 25 |
# File 'lib/grid_generator/svg/path.rb', line 23 def style @style end |
Instance Method Details
#to_svg ⇒ Object
25 26 27 |
# File 'lib/grid_generator/svg/path.rb', line 25 def to_svg "<path d=\"#{d}\" style=\"#{style}\" />" end |