Class: Space
- Inherits:
-
Object
- Object
- Space
- Defined in:
- lib/minesweeper.rb
Instance Attribute Summary collapse
-
#flagged ⇒ Object
Returns the value of attribute flagged.
-
#mine ⇒ Object
Returns the value of attribute mine.
-
#nearby_mines ⇒ Object
Returns the value of attribute nearby_mines.
-
#visible ⇒ Object
Returns the value of attribute visible.
Instance Method Summary collapse
- #clear? ⇒ Boolean
-
#initialize ⇒ Space
constructor
A new instance of Space.
- #zero_nearby? ⇒ Boolean
Constructor Details
#initialize ⇒ Space
194 195 196 197 198 199 |
# File 'lib/minesweeper.rb', line 194 def initialize @visible = false @flagged = false @mine = false @nearby_mines = nil end |
Instance Attribute Details
#flagged ⇒ Object
Returns the value of attribute flagged.
192 193 194 |
# File 'lib/minesweeper.rb', line 192 def flagged @flagged end |
#mine ⇒ Object
Returns the value of attribute mine.
192 193 194 |
# File 'lib/minesweeper.rb', line 192 def mine @mine end |
#nearby_mines ⇒ Object
Returns the value of attribute nearby_mines.
192 193 194 |
# File 'lib/minesweeper.rb', line 192 def nearby_mines @nearby_mines end |
#visible ⇒ Object
Returns the value of attribute visible.
192 193 194 |
# File 'lib/minesweeper.rb', line 192 def visible @visible end |
Instance Method Details
#clear? ⇒ Boolean
201 202 203 |
# File 'lib/minesweeper.rb', line 201 def clear? visible && !mine end |
#zero_nearby? ⇒ Boolean
205 206 207 |
# File 'lib/minesweeper.rb', line 205 def zero_nearby? clear? && self.nearby_mines == 0 end |