Method: MethodFinder.methods_to_try
- Defined in:
- lib/methodfinder.rb
.methods_to_try(obj) ⇒ Object
Returns a list of candidate methods for a given object. Added by Jan Lelis.
117 118 119 120 121 122 123 124 125 |
# File 'lib/methodfinder.rb', line 117 def methods_to_try(obj) ret = obj.methods blacklist = obj.is_a?(Module) ? CLASS_METHOD_BLACKLIST : INSTANCE_METHOD_BLACKLIST klass = obj.is_a?(Module) ? obj : obj.class klass.ancestors.each { |ancestor| ret -= blacklist[ancestor.to_s.intern] } ret.sort end |