lib/cards_lib/deck.rb in cards_lib-0.2.1 vs lib/cards_lib/deck.rb in cards_lib-0.2.2
- old
+ new
@@ -1,11 +1,12 @@
module CardsLib
class Deck
def initialize(options = {})
cards = options.fetch(:cards) { Standard::PLAYING_CARDS }
+ ranker = options.fetch(:ranker){ Ranker }
@seed = options.fetch(:seed) { Random.new.seed }
@top = 0
- @cards = cards.map {|c| Card.new(c) }.shuffle(random: Random.new(@seed)).to_enum
+ @cards = cards.map {|c| Card.new(c, ranker) }.shuffle(random: Random.new(@seed)).to_enum
end
def inspect
"<Deck: #{size} Cards - Seed##{@seed}>"
end