Module: Inform::Library

Defined in:
lib/runtime/library.rb,
lib/runtime/library_loader.rb

Overview

The Inform::Library module

Defined Under Namespace

Modules: ClassMethods, Loader Classes: LibraryLoadError

Constant Summary collapse

GEM_NAME =
'inform6lib'.freeze
DeclaredProperties =
Struct.new(:memo).new({})
DeclaredAttributes =
Struct.new(:memo).new(Set.new)
DeclaredGlobals =
Struct.new(:memo).new([])

Class Method Summary collapse

Class Method Details

.inform_gem_lib_pathObject



35
36
37
# File 'lib/runtime/library_loader.rb', line 35

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

.load_library_methodsObject

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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/runtime/library.rb', line 40

def load_library_methods
  library_methods = Set.new
  library_methods.merge(StdLib.instance_methods(false))
  library_methods.merge(Inform::IO.instance_methods(false))
  library_methods.merge(Inform.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.debug "Loaded library methods: #{@methods_index}"
end

.methods_indexObject



29
30
31
32
33
# File 'lib/runtime/library.rb', line 29

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