Module: StoryTeller::Library

Defined in:
lib/story_teller/library.rb,
lib/story_teller/library/loader.rb,
lib/story_teller/library/location.rb,
lib/story_teller/library/bootstrap.rb,
lib/story_teller/library/directives.rb,
lib/story_teller/library/declarations.rb

Overview

The StoryTeller::Library module

Defined Under Namespace

Modules: Bootstrap, Directives, Loader, Location, LocationInstaller, LocationTracePoint Classes: Declarations, LibraryLoadError

Constant Summary collapse

GEM_NAME =
'inform6lib'.freeze

Class Method Summary collapse

Class Method Details

.declarationsObject



39
40
41
# File 'lib/story_teller/library.rb', line 39

def declarations
  @declarations ||= Declarations.new
end

.inform_gem_lib_pathObject



34
35
36
# File 'lib/story_teller/library.rb', line 34

def inform_gem_lib_path
  @inform_gem_lib_path ||= File.expand_path(File.join(StoryTeller::Library::GEM_PATH, 'lib'))
end

.load_library_methodsObject

rubocop: disable Metrics/AbcSize rubocop: disable Metrics/MethodLength



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/story_teller/library.rb', line 55

def load_library_methods
  library_methods = Set.new
  library_methods.merge(Inform::StdLib.instance_methods(false))
  library_methods.merge(StoryTeller::IO.instance_methods(false))
  library_methods.merge(StoryTeller.instance_methods(false))
  library_methods.merge(InformLibrary.instance_methods(false))
  Inform.included_modules.each do |mod|
    library_methods.merge(mod.instance_methods(false))
  end
  InformLibrary.included_modules.each do |mod|
    library_methods.merge(mod.instance_methods(false))
  end
  @methods_index.concat(library_methods.to_a).sort
  log.trace "Loaded library methods: #{@methods_index}"
end

.methods_indexObject



44
45
46
47
48
# File 'lib/story_teller/library.rb', line 44

def methods_index
  return @methods_index unless @methods_index.empty?
  load_library_methods
  @methods_index
end