14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/dissociated_introspection/recording_parent.rb', line 14
def const_missing(const_sym)
if const_defined?("::#{const_sym}")
Kernel.const_get("::#{const_sym}")
else
const = self.const_set(const_sym, Module.new)
const.extend ConstMissing
const.module_eval(<<-RUBY, __FILE__, __LINE__+1)
def self.name
"#{name.gsub(/#<Module:.*>::/, '')}::#{const_sym}"
end
def self.inspect
name
end
RUBY
RecordingParent.__missing_constants__[const_sym] = const
const
end
end
|