Class: TicTacToe::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb

Constant Summary collapse

EMPTY =
""

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCell

Returns a new instance of Cell.



6
7
8
# File 'lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb', line 6

def initialize
  reset
end

Instance Attribute Details

#emptyObject

Returns the value of attribute empty.



4
5
6
# File 'lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb', line 4

def empty
  @empty
end

#signObject

Returns the value of attribute sign.



4
5
6
# File 'lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb', line 4

def sign
  @sign
end

Instance Method Details

#mark(sign) ⇒ Object



10
11
12
# File 'lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb', line 10

def mark(sign)
  self.sign = sign
end

#markedObject



23
24
25
# File 'lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb', line 23

def marked
  !empty
end

#resetObject



14
15
16
# File 'lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe/cell.rb', line 14

def reset
  self.sign = EMPTY
end