module RecordingParent::ConstMissing

Public Instance Methods

const_missing(const_sym) click to toggle source
# File lib/dissociated_introspection/recording_parent.rb, line 12
      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