class BoardGameGrid::Point
Point
¶ ↑
A point with an x and y co-ordinates
Attributes
x[R]
@return [Fixnum] the x co-ordinate.
y[R]
@return [Fixnum] the y co-ordinate.
Public Class Methods
new(x, y)
click to toggle source
Public Instance Methods
+(other)
click to toggle source
Add a point to another point by adding their co-ordinates and returning a new point.
@param [Point] other
the other point to add.
@return [Point]
# File lib/board_game_grid/point.rb, line 38 def +(other) self.class.new(self.x + other.x, self.y + other.y) end
==(other)
click to toggle source
Check if popints are equal by seeing if their co-ordinates are equal.
@param [Point] other
the other point to compare to.
@return [TrueClass, FalseClass]
# File lib/board_game_grid/point.rb, line 48 def ==(other) self.x == other.x && self.y == other.y end