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.
446 447 448 |
# File 'lib/zyps.rb', line 446 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.
444 445 446 |
# File 'lib/zyps.rb', line 444 def x @x end |
#y ⇒ Object
Coordinates can be negative, and don’t have to be integers.
444 445 446 |
# File 'lib/zyps.rb', line 444 def y @y end |
Instance Method Details
#copy ⇒ Object
Make a deep copy.
451 |
# File 'lib/zyps.rb', line 451 def copy; self.clone; end |