Class: CoopAl::AdventureGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/coop_al/adventure_generator.rb

Overview

AdventureGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description, bestiary) ⇒ AdventureGenerator

Returns a new instance of AdventureGenerator.



8
9
10
11
# File 'lib/coop_al/adventure_generator.rb', line 8

def initialize(name, description, bestiary)
  initialize_adventure(name, description)
  @bestiary = bestiary
end

Instance Attribute Details

#adventureObject (readonly)

Returns the value of attribute adventure.



6
7
8
# File 'lib/coop_al/adventure_generator.rb', line 6

def adventure
  @adventure
end

Instance Method Details

#chapter(name, description, &blk) ⇒ Object



17
18
19
20
21
# File 'lib/coop_al/adventure_generator.rb', line 17

def chapter(name, description, &blk)
  generator = ChapterGenerator.new(name, description, @adventure, @bestiary)
  generator.instance_eval(&blk)
  @adventure.add_chapter(generator.chapter)
end

#entry(name) ⇒ Object



13
14
15
# File 'lib/coop_al/adventure_generator.rb', line 13

def entry(name)
  @adventure.add_entry(name)
end