Module: Ronin::AutoLoad::ClassMethods

Defined in:
lib/ronin/auto_load.rb

Overview

Since:

  • 1.1.0

Instance Method Summary collapse

Instance Method Details

#const_missing(name) ⇒ Class, Module (protected)

Transparently auto-loads Classes and Modules from their respective files using OpenNamespace.

Parameters:

  • name (String, Symbol)

    The name of the Class or Module to auto-load.

Returns:

  • (Class, Module)

    The loaded Class or Module.

Raises:

  • (NameError)

    The Class or Module could not be found.

Since:

  • 1.1.0



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ronin/auto_load.rb', line 55

def const_missing(name)
  const = super(name)

  if Object.const_defined?('DataMapper')
    # if the loaded Class is a DataMapper Resource, re-finalize
    if const < DataMapper::Resource
      DataMapper.finalize
    end
  end

  return const
end