class Gamefic::Active::Epic
A collection of narratives.
Attributes
narratives[R]
@return [Set<Narrative>]
Public Class Methods
new()
click to toggle source
# File lib/gamefic/active/epic.rb, line 13 def initialize @narratives = Set.new end
Public Instance Methods
add(narrative)
click to toggle source
@param narrative [Narrative]
# File lib/gamefic/active/epic.rb, line 18 def add narrative narratives.add narrative end
delete(narrative)
click to toggle source
@param narrative [Narrative]
# File lib/gamefic/active/epic.rb, line 23 def delete narrative narratives.delete narrative end
empty?()
click to toggle source
# File lib/gamefic/active/epic.rb, line 42 def empty? narratives.empty? end
one?()
click to toggle source
# File lib/gamefic/active/epic.rb, line 46 def one? narratives.one? end
responses_for(*verbs)
click to toggle source
@return [Array<Response>]
# File lib/gamefic/active/epic.rb, line 55 def responses_for(*verbs) rulebooks.to_a .reverse .flat_map { |rb| rb.responses_for(*verbs) } end
rulebooks()
click to toggle source
@return [Array<Rulebook>]
# File lib/gamefic/active/epic.rb, line 28 def rulebooks narratives.map(&:rulebook) end
select_scene(name)
click to toggle source
@param name [Symbol] @return [Scene]
# File lib/gamefic/active/epic.rb, line 63 def select_scene name scenes = rulebooks.map { |rlbk| rlbk.scenes[name] } .compact raise ArgumentError, "Scene named `#{name}` does not exist" if scenes.empty? logger.warn "Found #{scenes.length} scenes named `#{name}`" unless scenes.one? scenes.last end
synonyms()
click to toggle source
@return [Array<Symbol>]
# File lib/gamefic/active/epic.rb, line 38 def synonyms rulebooks.flat_map(&:synonyms).uniq end
syntaxes()
click to toggle source
# File lib/gamefic/active/epic.rb, line 50 def syntaxes rulebooks.flat_map(&:syntaxes) end
verbs()
click to toggle source
@return [Array<Symbol>]
# File lib/gamefic/active/epic.rb, line 33 def verbs rulebooks.flat_map(&:verbs).uniq end