class CoopAl::Adventure
Attributes
chapters[R]
description[R]
name[R]
Public Class Methods
new(name, description)
click to toggle source
# File lib/coop_al/adventure.rb, line 8 def initialize(name, description) @name = name @description = description @entries = [] @chapters = {} end
Public Instance Methods
add_chapter(chapter)
click to toggle source
# File lib/coop_al/adventure.rb, line 19 def add_chapter(chapter) @chapters[chapter.name] = chapter end
add_entry(path)
click to toggle source
# File lib/coop_al/adventure.rb, line 15 def add_entry(path) @entries << path end
all_chapter_names()
click to toggle source
# File lib/coop_al/adventure.rb, line 23 def all_chapter_names @chapters.keys end
all_entries()
click to toggle source
# File lib/coop_al/adventure.rb, line 35 def all_entries @entries.map { |e| Path.absolute(@name, e) } end
chapter(name)
click to toggle source
# File lib/coop_al/adventure.rb, line 43 def chapter(name) raise "Chapter (#{name}) not found" unless @chapters.key?(name) @chapters[name] end
chapter?(name)
click to toggle source
# File lib/coop_al/adventure.rb, line 39 def chapter?(name) @chapters.key?(name) end
chapter_by_path(path)
click to toggle source
# File lib/coop_al/adventure.rb, line 27 def chapter_by_path(path) @chapters[path.chapter] end
chapter_paths()
click to toggle source
# File lib/coop_al/adventure.rb, line 31 def chapter_paths @chapters.values.map(&:absolute_path) end
full_name()
click to toggle source
# File lib/coop_al/adventure.rb, line 48 def full_name @description end