Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/truck/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#const_missing(const) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/truck/core_ext.rb', line 2

def const_missing(const)
  offending_file = caller[0]
  $stderr.puts "Module#const_missing: const=#{const.inspect}, self=#{inspect}, file=#{offending_file}" if Truck.debug_mode
  catch :const do
    Truck::Autoloader.handle const, self, offending_file
  end
rescue NameError => name_error
  if name_error.class == NameError
    # Reraise the error to keep our junk out of the backtrace
    raise NameError, name_error.message
  else
    # NoMethodError inherits from NameError
    raise name_error
  end
end