Module: Law::Regulations::Core

Extended by:
ActiveSupport::Concern
Included in:
Law::RegulationBase
Defined in:
lib/law/regulations/core.rb

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments) ⇒ Object (private)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/law/regulations/core.rb', line 20

def method_missing(method_name, *arguments)
  petition_delegate, delegated_method_name, is_setter = petition_delegator_for_method_name(method_name)

  case delegation_type(petition_delegate, delegated_method_name, is_setter)
  when :delegate
    petition_delegate
  when :method
    petition_delegate.public_send(delegated_method_name, *arguments)
  when :attribute_set
    petition_delegate[delegated_method_name] = arguments.first
  when :attribute_sym
    petition_delegate[delegated_method_name]
  when :attribute_str
    petition_delegate[delegated_method_name.to_s]
  else
    super
  end
end