Class: Dotter::Dot
- Inherits:
-
Object
- Object
- Dotter::Dot
- Defined in:
- lib/dotter/dot.rb
Instance Attribute Summary collapse
-
#dot_color ⇒ Object
Returns the value of attribute dot_color.
-
#radius ⇒ Object
Returns the value of attribute radius.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #-(other) ⇒ Object
-
#initialize(x, y, opts = {}) ⇒ Dot
constructor
A new instance of Dot.
Constructor Details
#initialize(x, y, opts = {}) ⇒ Dot
Returns a new instance of Dot.
4 5 6 7 8 |
# File 'lib/dotter/dot.rb', line 4 def initialize(x, y, opts = {}) @x, @y = x, y @dot_color = opts.delete(:dot_color) end |
Instance Attribute Details
#dot_color ⇒ Object
Returns the value of attribute dot_color.
2 3 4 |
# File 'lib/dotter/dot.rb', line 2 def dot_color @dot_color end |
#radius ⇒ Object
Returns the value of attribute radius.
2 3 4 |
# File 'lib/dotter/dot.rb', line 2 def radius @radius end |
#x ⇒ Object
Returns the value of attribute x.
2 3 4 |
# File 'lib/dotter/dot.rb', line 2 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
2 3 4 |
# File 'lib/dotter/dot.rb', line 2 def y @y end |
Instance Method Details
#-(other) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/dotter/dot.rb', line 10 def -(other) dot = self.dup dot.x -= other.x dot.y -= other.y dot end |