Class: Im::Import
Instance Method Summary collapse
- #const_added(name) ⇒ Object
-
#initialize(root) ⇒ Import
constructor
A new instance of Import.
- #inspect ⇒ Object
Methods inherited from Module
#autoload, #im_original_autoload
Constructor Details
#initialize(root) ⇒ Import
Returns a new instance of Import.
105 106 107 108 109 110 111 112 113 |
# File 'lib/im.rb', line 105 def initialize(root) @root = root super() Im.with_import(self) do Im.toplevel_constants.each do |const| self.const_set(const, Object.const_get(const)) end end end |
Instance Method Details
#const_added(name) ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/im.rb', line 119 def const_added(name) path = const_source_location(name)[0] value = const_get(name, false) Im.registry[path] ||= Require.new(path, self) Im.registry[path].defined_constants[name] ||= value super end |
#inspect ⇒ Object
115 116 117 |
# File 'lib/im.rb', line 115 def inspect @inspect ||= "<#Im::Import root: #{@root}>" end |