Class: CardRepository
- Inherits:
-
Object
- Object
- CardRepository
- Includes:
- Singleton
- Defined in:
- lib/rora/repository/card_repository.rb
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize ⇒ CardRepository
constructor
A new instance of CardRepository.
Constructor Details
#initialize ⇒ CardRepository
Returns a new instance of CardRepository.
7 8 9 10 11 12 |
# File 'lib/rora/repository/card_repository.rb', line 7 def initialize @card_table = Hash.new CSV.foreach("lib/rora/cards.csv") do |row| @card_table[row[0]] = row[1].to_i end end |
Instance Method Details
#get(key) ⇒ Object
14 15 16 |
# File 'lib/rora/repository/card_repository.rb', line 14 def get(key) @card_table.fetch(key) end |