Class: ToBeRead::Deck

Inherits:
Object
  • Object
show all
Defined in:
lib/toberead/decks.rb

Instance Method Summary collapse

Constructor Details

#initialize(deck_type) ⇒ Deck

Returns a new instance of Deck.



5
6
7
8
9
10
11
# File 'lib/toberead/decks.rb', line 5

def initialize(deck_type)
  @deck = ERB.new(
    File.read(
      File.join(ToBeRead.template_dir, "#{deck_type}.erb")
    )
  ).result(binding).split("\n")
end

Instance Method Details

#shuffleObject



13
14
15
# File 'lib/toberead/decks.rb', line 13

def shuffle
  @deck.sample.downcase.titleize
end