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.
408 409 410 |
# File 'lib/zyps.rb', line 408 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.
406 407 408 |
# File 'lib/zyps.rb', line 406 def x @x end |
#y ⇒ Object
Coordinates can be negative, and don’t have to be integers.
406 407 408 |
# File 'lib/zyps.rb', line 406 def y @y end |
Instance Method Details
#copy ⇒ Object
Make a deep copy.
413 |
# File 'lib/zyps.rb', line 413 def copy; self.clone; end |