Class: Hand
Instance Method Summary collapse
- #cards ⇒ Object
-
#initialize(*card_strings) ⇒ Hand
constructor
A new instance of Hand.
- #to_s ⇒ Object
Constructor Details
#initialize(*card_strings) ⇒ Hand
Returns a new instance of Hand.
170 171 172 173 174 175 176 177 |
# File 'lib/hand_rank/test.rb', line 170 def initialize( *card_strings ) @cards = card_strings.map do |string| Card.new( value: value = string.to_i, suit: string.gsub( value.to_s, '' ).to_sym, ) end end |
Instance Method Details
#cards ⇒ Object
179 180 181 |
# File 'lib/hand_rank/test.rb', line 179 def cards @cards end |
#to_s ⇒ Object
183 184 185 |
# File 'lib/hand_rank/test.rb', line 183 def to_s @cards.map(&:to_s).join(', ') end |