Class: MethodLister::Finder
- Inherits:
-
Object
- Object
- MethodLister::Finder
- Defined in:
- lib/method_lister/finder.rb
Instance Method Summary collapse
- #find_all(object) ⇒ Object
- #grep(rx, object) ⇒ Object
- #ls(object) ⇒ Object
- #which(method, object) ⇒ Object
Instance Method Details
#find_all(object) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/method_lister/finder.rb', line 3 def find_all(object) @results, @seen = Array.new, Hash.new record_methods_for_eigenclass(object) search_class_hierarchy(object.class) @results end |
#grep(rx, object) ⇒ Object
14 15 16 17 18 |
# File 'lib/method_lister/finder.rb', line 14 def grep(rx, object) ls(object).map do |result| result.narrow_to_methods_matching!(rx) end.select { |result| result.has_methods? } end |
#ls(object) ⇒ Object
10 11 12 |
# File 'lib/method_lister/finder.rb', line 10 def ls(object) find_all(object).select { |results| results.has_methods? } end |
#which(method, object) ⇒ Object
20 21 22 |
# File 'lib/method_lister/finder.rb', line 20 def which(method, object) grep(/^#{Regexp.escape(method.to_s)}$/, object) end |