Module: DiceGame::TreasureTrove

Defined in:
lib/dice_game/treasure_trove.rb

Constant Summary collapse

Treasure =
Data.define(:name, :points)
TREASURES =
[
  Treasure.new("pie", 10),
  Treasure.new("coin", 25),
  Treasure.new("flute", 50),
  Treasure.new("compass", 65),
  Treasure.new("key", 80),
  Treasure.new("crown", 90),
  Treasure.new("star", 100)
]

Class Method Summary collapse

Class Method Details

.random_treasureObject



15
16
17
# File 'lib/dice_game/treasure_trove.rb', line 15

def self.random_treasure
  TREASURES.sample
end

.treasure_itemsObject



19
20
21
# File 'lib/dice_game/treasure_trove.rb', line 19

def self.treasure_items
  TREASURES.map { |treasure| "A #{treasure.name} is worth #{treasure.points} points"}
end