Method: Wanderer.search
- Defined in:
- lib/wanderer.rb
.search(receiver, look_up_method) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wanderer.rb', line 22 def self.search(receiver, look_up_method) visited = [] ancestors = receiver.singleton_class.ancestors ancestors.each do |ancestor| visited << ancestor return visited if ancestor.instance_methods(false).include?(look_up_method.to_sym) end visited << "method_missing" ancestors.each do |ancestor| visited << ancestor return visited if ancestor.instance_methods(false).include? :method_missing end end |