Class: Emfsvg::Svg::Elements::Rect
- Inherits:
-
Emfsvg::Svg::Element
- Object
- Emfsvg::Svg::Element
- Emfsvg::Svg::Elements::Rect
- Defined in:
- lib/emfsvg/svg/elements/rect.rb
Overview
Constant Summary collapse
- ELEMENT_NAME =
"rect"
Instance Attribute Summary collapse
-
#clip_path ⇒ Object
readonly
Returns the value of attribute clip_path.
-
#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.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x:, y:, width:, height:, rx:, ry:, fill:, stroke:, clip_path: nil) ⇒ Rect
constructor
A new instance of Rect.
- #rounded? ⇒ Boolean
Methods inherited from Emfsvg::Svg::Element
#children, #element_name, register
Constructor Details
#initialize(x:, y:, width:, height:, rx:, ry:, fill:, stroke:, clip_path: nil) ⇒ Rect
Returns a new instance of Rect.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 14 def initialize(x:, y:, width:, height:, rx:, ry:, fill:, stroke:, clip_path: nil) @x = x @y = y @width = width @height = height @rx = rx @ry = ry @fill = fill @stroke = stroke @clip_path = clip_path end |
Instance Attribute Details
#clip_path ⇒ Object (readonly)
Returns the value of attribute clip_path.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def clip_path @clip_path end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def fill @fill end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def height @height end |
#rx ⇒ Object (readonly)
Returns the value of attribute rx.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def rx @rx end |
#ry ⇒ Object (readonly)
Returns the value of attribute ry.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def ry @ry end |
#stroke ⇒ Object (readonly)
Returns the value of attribute stroke.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def stroke @stroke end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
12 13 14 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 12 def y @y end |
Class Method Details
.from_node(node) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 26 def self.from_node(node) new( x: AttributeParser.float(node["x"]), y: AttributeParser.float(node["y"]), width: AttributeParser.float(node["width"]), height: AttributeParser.float(node["height"]), rx: AttributeParser.float(node["rx"]), ry: AttributeParser.float(node["ry"]), **Stylable.parse_style(node) ) end |
Instance Method Details
#rounded? ⇒ Boolean
38 39 40 |
# File 'lib/emfsvg/svg/elements/rect.rb', line 38 def rounded? rx.positive? || ry.positive? end |