Class: Minesweeper::Cells::State

Inherits:
Object
  • Object
show all
Defined in:
lib/minesweeper/cells/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color:, status:, view:) ⇒ State

Returns a new instance of State.



8
9
10
11
12
# File 'lib/minesweeper/cells/state.rb', line 8

def initialize(color:, status:, view:)
  @view = view
  @color = color
  @status = status
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



6
7
8
# File 'lib/minesweeper/cells/state.rb', line 6

def color
  @color
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/minesweeper/cells/state.rb', line 6

def status
  @status
end

#viewObject

Returns the value of attribute view.



6
7
8
# File 'lib/minesweeper/cells/state.rb', line 6

def view
  @view
end

Instance Method Details

#marked_as_bomb?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/minesweeper/cells/state.rb', line 18

def marked_as_bomb?
  status == :marked_as_bomb
end

#opened?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/minesweeper/cells/state.rb', line 14

def opened?
  status == :opened
end