Module: StudioGame::TreasureTrove
- Defined in:
- lib/studio_game/treasure_trove.rb
Constant Summary collapse
- TREASURES =
[ Treasure.new(:pie, 5), Treasure.new(:bottle, 25), Treasure.new(:hammer, 50), Treasure.new(:skillet, 100), Treasure.new(:broomstick, 200), Treasure.new(:crowbar, 400), ]
Class Method Summary collapse
Class Method Details
.print_treasures ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/studio_game/treasure_trove.rb', line 14 def TreasureTrove.print_treasures puts "\nThere are #{TREASURES.size} treasures to be found:\n" TREASURES.each do |tr| puts "A #{tr.name} is worth #{tr.points} points." # puts "A #{tr[0]} is worth #{tr[1]} points." # .. tr.name & tr[0] are equivalent end end |
.random ⇒ Object
23 24 25 |
# File 'lib/studio_game/treasure_trove.rb', line 23 def self.random TREASURES.sample end |