class TwentyOne::Chip
Attributes
color[R]
value[R]
Public Class Methods
generate_chips(color, total)
click to toggle source
# File lib/twenty_one/chip.rb, line 20 def self.generate_chips(color, total) set = [] total.times do set.push Chip.new(color) end set end
get_amount(chips)
click to toggle source
# File lib/twenty_one/chip.rb, line 30 def self.get_amount(chips) amount = 0 chips.each do |chip| amount += chip.value end amount end
new(color)
click to toggle source
# File lib/twenty_one/chip.rb, line 5 def initialize(color) @color = color case color when :white @value = 1 when :red @value = 5 when :green @value = 25 when :black @value = 100 end end