class SnakeGame::Position
Class for storing coordinates
Attributes
x[RW]
y[RW]
Public Class Methods
new(x, y)
click to toggle source
# File lib/position.rb, line 8 def initialize(x, y) @x = x @y = y end
Public Instance Methods
+(other)
click to toggle source
# File lib/position.rb, line 17 def +(other) Position.new (x + other.x) % WIDTH, (y + other.y) % HEIGHT end
==(other)
click to toggle source
# File lib/position.rb, line 13 def ==(other) x == other.x && y == other.y end