Class: RbSnake::Models::Coordinate

Inherits:
Object
  • Object
show all
Defined in:
lib/rb_snake/models/coordinate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row:, col:) ⇒ Coordinate

Returns a new instance of Coordinate.



8
9
10
11
# File 'lib/rb_snake/models/coordinate.rb', line 8

def initialize(row:, col:)
  @row = row
  @col = col
end

Instance Attribute Details

#colObject

Returns the value of attribute col.



6
7
8
# File 'lib/rb_snake/models/coordinate.rb', line 6

def col
  @col
end

#rowObject

Returns the value of attribute row.



6
7
8
# File 'lib/rb_snake/models/coordinate.rb', line 6

def row
  @row
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/rb_snake/models/coordinate.rb', line 13

def eql?(other)
  row == other.row && col == other.col
end