Class: Postsvg::Svg::Elements::Line
- Inherits:
-
Postsvg::Svg::Element
- Object
- Postsvg::Svg::Element
- Postsvg::Svg::Elements::Line
- Defined in:
- lib/postsvg/svg/elements/line.rb
Constant Summary collapse
- ELEMENT_NAME =
"line"
Constants inherited from Postsvg::Svg::Element
Postsvg::Svg::Element::REGISTRY
Instance Attribute Summary collapse
-
#stroke ⇒ Object
readonly
Returns the value of attribute stroke.
-
#stroke_paint ⇒ Object
readonly
Returns the value of attribute stroke_paint.
-
#x1 ⇒ Object
readonly
Returns the value of attribute x1.
-
#x2 ⇒ Object
readonly
Returns the value of attribute x2.
-
#y1 ⇒ Object
readonly
Returns the value of attribute y1.
-
#y2 ⇒ Object
readonly
Returns the value of attribute y2.
Attributes inherited from Postsvg::Svg::Element
#attributes, #children, #clip_path_id, #fill, #transform
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x1:, y1:, x2:, y2:, stroke_paint:, stroke:, **rest) ⇒ Line
constructor
A new instance of Line.
Methods inherited from Postsvg::Svg::Element
#default_fill, #element_name, register, registry
Constructor Details
#initialize(x1:, y1:, x2:, y2:, stroke_paint:, stroke:, **rest) ⇒ Line
Returns a new instance of Line.
12 13 14 15 16 17 18 19 20 |
# File 'lib/postsvg/svg/elements/line.rb', line 12 def initialize(x1:, y1:, x2:, y2:, stroke_paint:, stroke:, **rest) super(**rest) @x1 = x1 @y1 = y1 @x2 = x2 @y2 = y2 @stroke_paint = stroke_paint @stroke = stroke end |
Instance Attribute Details
#stroke ⇒ Object (readonly)
Returns the value of attribute stroke.
10 11 12 |
# File 'lib/postsvg/svg/elements/line.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/line.rb', line 10 def stroke_paint @stroke_paint end |
#x1 ⇒ Object (readonly)
Returns the value of attribute x1.
10 11 12 |
# File 'lib/postsvg/svg/elements/line.rb', line 10 def x1 @x1 end |
#x2 ⇒ Object (readonly)
Returns the value of attribute x2.
10 11 12 |
# File 'lib/postsvg/svg/elements/line.rb', line 10 def x2 @x2 end |
#y1 ⇒ Object (readonly)
Returns the value of attribute y1.
10 11 12 |
# File 'lib/postsvg/svg/elements/line.rb', line 10 def y1 @y1 end |
#y2 ⇒ Object (readonly)
Returns the value of attribute y2.
10 11 12 |
# File 'lib/postsvg/svg/elements/line.rb', line 10 def y2 @y2 end |
Class Method Details
.from_node(node) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/postsvg/svg/elements/line.rb', line 22 def self.from_node(node) new(x1: AttributeParser.number(node["x1"], default: 0), y1: AttributeParser.number(node["y1"], default: 0), x2: AttributeParser.number(node["x2"], default: 0), y2: AttributeParser.number(node["y2"], default: 0), 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 |