Class: ToBeRead::Deck
- Inherits:
-
Object
- Object
- ToBeRead::Deck
- Defined in:
- lib/toberead/decks.rb
Instance Method Summary collapse
-
#initialize(deck_type) ⇒ Deck
constructor
A new instance of Deck.
- #shuffle ⇒ Object
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
#shuffle ⇒ Object
13 14 15 |
# File 'lib/toberead/decks.rb', line 13 def shuffle @deck.sample.downcase.titleize end |