Module: LazyRecord::DynamicModules

Defined in:
lib/lazy_record/dynamic_modules.rb

Overview

Generate dynamic modules for dynamic methods created with #define_method, for insertion into inheritance chain. This allows you to make calls to super for these methods.

Instance Method Summary collapse

Instance Method Details

#get_or_set_mod(module_name) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/lazy_record/dynamic_modules.rb', line 8

def get_or_set_mod(module_name)
  if const_defined?(module_name, _search_ancestors = false)
    const_get(module_name)
  else
    const_set(module_name, Module.new)
  end
end