Class: Zyps::Location
- Inherits:
-
Object
- Object
- Zyps::Location
- Defined in:
- lib/zyps.rb
Overview
An object’s location, with x and y coordinates.
Instance Attribute Summary collapse
-
#x ⇒ Object
Coordinates can be negative, and don’t have to be integers.
-
#y ⇒ Object
Coordinates can be negative, and don’t have to be integers.
Instance Method Summary collapse
-
#copy ⇒ Object
Make a deep copy.
-
#initialize(x = 0, y = 0) ⇒ Location
constructor
A new instance of Location.
Constructor Details
#initialize(x = 0, y = 0) ⇒ Location
Returns a new instance of Location.
447 448 449 |
# File 'lib/zyps.rb', line 447 def initialize (x = 0, y = 0) self.x, self.y = x, y end |
Instance Attribute Details
#x ⇒ Object
Coordinates can be negative, and don’t have to be integers.
445 446 447 |
# File 'lib/zyps.rb', line 445 def x @x end |
#y ⇒ Object
Coordinates can be negative, and don’t have to be integers.
445 446 447 |
# File 'lib/zyps.rb', line 445 def y @y end |
Instance Method Details
#copy ⇒ Object
Make a deep copy.
452 |
# File 'lib/zyps.rb', line 452 def copy; self.clone; end |