Class: Minesweeper::Core::Explosives::MineCoordinates
- Inherits:
-
Object
- Object
- Minesweeper::Core::Explosives::MineCoordinates
- Defined in:
- lib/minesweeper/core/explosives/mine_coordinates.rb
Instance Attribute Summary collapse
-
#col_index ⇒ Object
readonly
Returns the value of attribute col_index.
-
#row_index ⇒ Object
readonly
Returns the value of attribute row_index.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(row_index, col_index) ⇒ MineCoordinates
constructor
A new instance of MineCoordinates.
Constructor Details
#initialize(row_index, col_index) ⇒ MineCoordinates
Returns a new instance of MineCoordinates.
7 8 9 10 |
# File 'lib/minesweeper/core/explosives/mine_coordinates.rb', line 7 def initialize(row_index, col_index) @row_index = row_index @col_index = col_index end |
Instance Attribute Details
#col_index ⇒ Object (readonly)
Returns the value of attribute col_index.
5 6 7 |
# File 'lib/minesweeper/core/explosives/mine_coordinates.rb', line 5 def col_index @col_index end |
#row_index ⇒ Object (readonly)
Returns the value of attribute row_index.
5 6 7 |
# File 'lib/minesweeper/core/explosives/mine_coordinates.rb', line 5 def row_index @row_index end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
12 13 14 15 16 |
# File 'lib/minesweeper/core/explosives/mine_coordinates.rb', line 12 def ==(other) self.class == other.class && self.row_index == other.row_index && self.col_index == other.col_index end |
#hash ⇒ Object
19 20 21 |
# File 'lib/minesweeper/core/explosives/mine_coordinates.rb', line 19 def hash [@row_index, @col_index].hash end |