Method: Interloper::ClassMethods#interloper_module

Defined in:
lib/interloper.rb

#interloper_moduleObject

Generates an Interloper module that is namespaced under the including class, if one does not already exist. Then prepends the Interloper module to the including class.

Returns:

  • Module the Interloper module that was prepended to the including class.



28
29
30
31
32
33
34
# File 'lib/interloper.rb', line 28

def interloper_module
  @interloper_module ||= begin
    const_set(interloper_const_name, generate_interloper_module)
    prepend const_get(interloper_const_name)
    const_get(interloper_const_name)
  end
end