Class: Zyps::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/zyps.rb

Overview

An object’s location, with x and y coordinates.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#xObject

Coordinates can be negative, and don’t have to be integers.



444
445
446
# File 'lib/zyps.rb', line 444

def x
  @x
end

#yObject

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

#copyObject

Make a deep copy.



451
# File 'lib/zyps.rb', line 451

def copy; self.clone; end