Module: Protocol::Utilities

Defined in:
lib/protocol/utilities.rb

Overview

A module for some Utility methods.

Class Method Summary collapse

Class Method Details

.find_method_module(methodname, ancestors) ⇒ Object

This Method tries to find the first module that implements the method named methodname in the array of ancestors. If this fails nil is returned.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/protocol/utilities.rb', line 9

def find_method_module(methodname, ancestors)
  methodname = methodname.to_s
  ancestors.each do |a|
    begin
      a.instance_method(methodname)
      return a
    rescue NameError
    end
  end
  nil
end