Class: Laser::Cutter::Geometry::Shape
- Inherits:
-
Object
- Object
- Laser::Cutter::Geometry::Shape
- Defined in:
- lib/laser-cutter/geometry/shape.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
- #move_to(new_point) ⇒ Object
-
#relocate! ⇒ Object
Implement in each shape to move to the new pointd.
- #x ⇒ Object
- #x=(value) ⇒ Object
- #y ⇒ Object
- #y=(value) ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/laser-cutter/geometry/shape.rb', line 5 def name @name end |
#position ⇒ Object
Returns the value of attribute position.
5 6 7 |
# File 'lib/laser-cutter/geometry/shape.rb', line 5 def position @position end |
Instance Method Details
#move_to(new_point) ⇒ Object
25 26 27 28 29 |
# File 'lib/laser-cutter/geometry/shape.rb', line 25 def move_to new_point self.position = new_point relocate! self end |
#relocate! ⇒ Object
Implement in each shape to move to the new pointd
33 34 35 |
# File 'lib/laser-cutter/geometry/shape.rb', line 33 def relocate! raise 'Abstract method' end |
#x ⇒ Object
14 15 16 |
# File 'lib/laser-cutter/geometry/shape.rb', line 14 def x position.x end |
#x=(value) ⇒ Object
11 12 13 |
# File 'lib/laser-cutter/geometry/shape.rb', line 11 def x= value position.x = value end |
#y ⇒ Object
21 22 23 |
# File 'lib/laser-cutter/geometry/shape.rb', line 21 def y position.y end |
#y=(value) ⇒ Object
18 19 20 |
# File 'lib/laser-cutter/geometry/shape.rb', line 18 def y= value position.y = value end |