Module: Monkey::Ext::Module

Defined in:
lib/monkey/ext/module.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/monkey/ext/module.rb', line 17

def method_missing(name, *args, &block)
  if respond_to? :parent and parent.respond_to? :nested_method_missing
    parent.nested_method_missing(self, name, *args, &block)
  else
    method_missing_without_nesting(name, *args, &block)
  end
end

Instance Method Details

#nested_method_missing(mod, name, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/monkey/ext/module.rb', line 7

def nested_method_missing(mod, name, *args, &block)
  Monkey.invisible __FILE__ do
    if respond_to? :parent and parent != self
      parent.send(:nested_method_missing, mod, name, *args, &block)
    else
      mod.send(:method_missing_without_nesting, name, *args) 
    end
  end
end