Module: Parameters::ModuleMethods

Defined in:
lib/parameters/module_methods.rb

Instance Method Summary collapse

Instance Method Details

#extended(object) ⇒ Object

Ensures that the module will initialize parameters, when extended into an Object.



22
23
24
25
26
# File 'lib/parameters/module_methods.rb', line 22

def extended(object)
  each_param do |param|
    object.params[param.name] = param.to_instance(object)
  end
end

#included(base) ⇒ Object

Ensures that the module will re-extend Parameters::ClassMethods, when included.



9
10
11
12
13
14
15
16
# File 'lib/parameters/module_methods.rb', line 9

def included(base)
  base.extend ClassMethods

  if base.kind_of?(Module)
    # re-extend the ModuleMethods
    base.extend ModuleMethods
  end
end