Class: CoopAl::Chapter
- Inherits:
-
Object
- Object
- CoopAl::Chapter
- Defined in:
- lib/coop_al/chapter.rb
Overview
Chapter
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#encounters ⇒ Object
readonly
Returns the value of attribute encounters.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #absolute_path ⇒ Object
- #add_encounter(encounter) ⇒ Object
- #add_link(path) ⇒ Object
- #adventure_name ⇒ Object
- #follow(state, log) ⇒ Object
- #full_name ⇒ Object
-
#initialize(name, description, adventure) ⇒ Chapter
constructor
A new instance of Chapter.
- #link_to_downtime ⇒ Object
- #links_to_downtime? ⇒ Boolean
Constructor Details
#initialize(name, description, adventure) ⇒ Chapter
Returns a new instance of Chapter.
8 9 10 11 12 13 14 15 |
# File 'lib/coop_al/chapter.rb', line 8 def initialize(name, description, adventure) @name = name @description = description @adventure = adventure @encounters = [] @links = [] @links_to_downtime = false end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/coop_al/chapter.rb', line 6 def description @description end |
#encounters ⇒ Object (readonly)
Returns the value of attribute encounters.
6 7 8 |
# File 'lib/coop_al/chapter.rb', line 6 def encounters @encounters end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
6 7 8 |
# File 'lib/coop_al/chapter.rb', line 6 def links @links end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/coop_al/chapter.rb', line 6 def name @name end |
Instance Method Details
#absolute_path ⇒ Object
43 44 45 |
# File 'lib/coop_al/chapter.rb', line 43 def absolute_path Path.Absolute(@adventure.name, @name) end |
#add_encounter(encounter) ⇒ Object
21 22 23 |
# File 'lib/coop_al/chapter.rb', line 21 def add_encounter(encounter) @encounters << encounter end |
#add_link(path) ⇒ Object
25 26 27 |
# File 'lib/coop_al/chapter.rb', line 25 def add_link(path) @links << path end |
#adventure_name ⇒ Object
17 18 19 |
# File 'lib/coop_al/chapter.rb', line 17 def adventure_name @adventure.description end |
#follow(state, log) ⇒ Object
37 38 39 40 41 |
# File 'lib/coop_al/chapter.rb', line 37 def follow(state, log) @encounters.each do |encounter| encounter.run(state, log) end end |
#full_name ⇒ Object
47 48 49 |
# File 'lib/coop_al/chapter.rb', line 47 def full_name @adventure.full_name + ' - ' + @description end |
#link_to_downtime ⇒ Object
29 30 31 |
# File 'lib/coop_al/chapter.rb', line 29 def link_to_downtime @links_to_downtime = true end |
#links_to_downtime? ⇒ Boolean
33 34 35 |
# File 'lib/coop_al/chapter.rb', line 33 def links_to_downtime? @links_to_downtime end |