Sha256: 96be72efd46fe787f634e5973805626b6d12a07106a866788aa17d144f0da63e
Contents?: true
Size: 512 Bytes
Versions: 1
Compression:
Stored size: 512 Bytes
Contents
class Array def to_i self.map do |char| char.to_i end end end class String def to_i begin case self.upcase when 'J' then 11 when 'Q' then 12 when 'K' then 13 when 'A' then 1 else Integer(self) end rescue ArgumentError raise " unknown number: '#{self}'" end end def to_p {'11' => 'J', '12' => 'Q', '13' => 'K'}.each {|number, poker| self.gsub!(number, poker)} self end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
24games-0.2.4 | lib/calc24/ext.rb |