Module: StudioGame::TreasureTrove

Defined in:
lib/studio_game/treasure_trove.rb

Overview

treasure trove module

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)
].freeze

Class Method Summary collapse

Class Method Details

.random_treasureObject



18
19
20
# File 'lib/studio_game/treasure_trove.rb', line 18

def self.random_treasure
  TREASURES.sample
end

.treasure_itemsObject



22
23
24
# File 'lib/studio_game/treasure_trove.rb', line 22

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