Class: BetweenTheSheets::Wager

Inherits:
Object
  • Object
show all
Defined in:
lib/between_the_sheets/wager.rb

Class Method Summary collapse

Class Method Details

.get(credits, pot) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/between_the_sheets/wager.rb', line 3

def self.get(credits, pot)
  loop do
    input = Ask.print "What's your wager? ", to_int: true

    if input > pot
      puts "Invalid amount. You can't bet more than the pot (#{pot})"
      next
    end

    break input if input > 0 && input <= credits
    puts "Invalid amount. You have #{credits} credits."
  end
end