Module: Switchman::CallSuper

Defined in:
lib/switchman/call_super.rb

Instance Method Summary collapse

Instance Method Details

#call_super(method, above_module, *args, &block) ⇒ Object



13
14
15
# File 'lib/switchman/call_super.rb', line 13

def call_super(method, above_module, *args, &block)
  super_method_above(method, above_module).call(*args, &block)
end

#super_method_above(method_name, above_module) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/switchman/call_super.rb', line 3

def super_method_above(method_name, above_module)
  method = method(method_name)
  last_owner = method.owner
  while method.owner != above_module
    method = method.super_method
    raise "Could not find super method ``#{method_name}' for #{self.class}" if method.owner == last_owner
  end
  method.super_method
end