Class: Plushie::Canvas::Shape::Circle
- Inherits:
-
Data
- Object
- Data
- Plushie::Canvas::Shape::Circle
- Defined in:
- lib/plushie/canvas/shape/circle.rb
Overview
Circle shape.
Instance Attribute Summary collapse
-
#fill ⇒ Object
readonly
Returns the value of attribute fill.
-
#opacity ⇒ Object
readonly
Returns the value of attribute opacity.
-
#r ⇒ Object
readonly
Returns the value of attribute r.
-
#stroke ⇒ Object
readonly
Returns the value of attribute stroke.
-
#stroke_width ⇒ Object
readonly
Returns the value of attribute stroke_width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Access shape properties by key.
-
#initialize(x:, y:, r:, fill: nil, stroke: nil, stroke_width: nil, opacity: nil) ⇒ Circle
constructor
A new instance of Circle.
-
#to_wire ⇒ Object
private
Encode shape for the wire protocol.
Constructor Details
#initialize(x:, y:, r:, fill: nil, stroke: nil, stroke_width: nil, opacity: nil) ⇒ Circle
Returns a new instance of Circle.
8 9 10 |
# File 'lib/plushie/canvas/shape/circle.rb', line 8 def initialize(x:, y:, r:, fill: nil, stroke: nil, stroke_width: nil, opacity: nil) super end |
Instance Attribute Details
#fill ⇒ Object (readonly)
Returns the value of attribute fill
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def fill @fill end |
#opacity ⇒ Object (readonly)
Returns the value of attribute opacity
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def opacity @opacity end |
#r ⇒ Object (readonly)
Returns the value of attribute r
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def r @r end |
#stroke ⇒ Object (readonly)
Returns the value of attribute stroke
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def stroke @stroke end |
#stroke_width ⇒ Object (readonly)
Returns the value of attribute stroke_width
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def stroke_width @stroke_width end |
#x ⇒ Object (readonly)
Returns the value of attribute x
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y
7 8 9 |
# File 'lib/plushie/canvas/shape/circle.rb', line 7 def y @y end |
Instance Method Details
#[](key) ⇒ Object
Access shape properties by key.
16 |
# File 'lib/plushie/canvas/shape/circle.rb', line 16 def [](key) = to_wire[key] |
#to_wire ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Encode shape for the wire protocol.
20 21 22 23 24 25 26 27 |
# File 'lib/plushie/canvas/shape/circle.rb', line 20 def to_wire h = {type: "circle", x: x, y: y, r: r} h[:fill] = fill if fill h[:stroke] = stroke if stroke h[:stroke_width] = stroke_width if stroke_width h[:opacity] = opacity if opacity h end |