class RubyHoldem::Round::MoveFactory

Attributes

amount[R]
move_type[R]
player[R]
round[R]

Public Class Methods

new(round, player, move_type, amount) click to toggle source
# File lib/ruby_holdem/round/move_factory.rb, line 6
def initialize(round, player, move_type, amount)
  @round = round
  @player = player
  @move_type = move_type
  @amount = amount
end

Public Instance Methods

build() click to toggle source
# File lib/ruby_holdem/round/move_factory.rb, line 13
def build
  {
    player: player,
    stage: stage,
    move_type: move_type,
    amount: actual_amount
  }
end

Private Instance Methods

actual_amount() click to toggle source
# File lib/ruby_holdem/round/move_factory.rb, line 24
def actual_amount
  if move_type == "call"
    highest_bet_placed - current_bet_amount
  else
    amount
  end
end
current_bet_amount() click to toggle source

Dependencies on Player class

# File lib/ruby_holdem/round/move_factory.rb, line 46
def current_bet_amount
  @current_bet_amount ||= player.current_bet_amount
end
highest_bet_placed() click to toggle source
# File lib/ruby_holdem/round/move_factory.rb, line 39
def highest_bet_placed
  @highest_bet_placed ||= round.highest_bet_placed
end
stage() click to toggle source

Dependencies on Round class

# File lib/ruby_holdem/round/move_factory.rb, line 35
def stage
  round.stage
end