Class: RubyHoldem::Round::MoveHistory

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_holdem/round/move_history.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMoveHistory

Returns a new instance of MoveHistory.



6
7
8
9
# File 'lib/ruby_holdem/round/move_history.rb', line 6

def initialize
  @moves = []
  @stage = STAGES.first
end

Instance Attribute Details

#movesObject (readonly)

Returns the value of attribute moves.



4
5
6
# File 'lib/ruby_holdem/round/move_history.rb', line 4

def moves
  @moves
end

#stageObject (readonly)

Returns the value of attribute stage.



4
5
6
# File 'lib/ruby_holdem/round/move_history.rb', line 4

def stage
  @stage
end

Instance Method Details

#add_move(move) ⇒ Object



11
12
13
# File 'lib/ruby_holdem/round/move_history.rb', line 11

def add_move(move)
  moves << move
end

#last_moveObject



15
16
17
# File 'lib/ruby_holdem/round/move_history.rb', line 15

def last_move
  moves.last
end

#next_stageObject



23
24
25
# File 'lib/ruby_holdem/round/move_history.rb', line 23

def next_stage
  @stage = STAGES[STAGES.index(stage)+1]
end

#turns_playedObject



19
20
21
# File 'lib/ruby_holdem/round/move_history.rb', line 19

def turns_played
  moves.count
end