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