Module: Boson::MethodInspector::MoreMethodInspector
- Included in:
- Boson::MethodInspector
- Defined in:
- lib/boson/more_method_inspector.rb
Instance Method Summary collapse
- #during_new_method_added(mod, meth) ⇒ Object
-
#find_method_locations(mod, meth) ⇒ Object
Returns an array of the file and line number at which a method starts using a method.
- #has_inspector_method?(meth, inspector) ⇒ Boolean
- #set_arguments(mod, meth) ⇒ Object
Instance Method Details
#during_new_method_added(mod, meth) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/boson/more_method_inspector.rb', line 18 def during_new_method_added(mod, meth) if store[:temp].size < ALL_METHODS.size store[:method_locations] ||= {} if (result = find_method_locations(mod, meth)) store[:method_locations][meth.to_s] = result end end end |
#find_method_locations(mod, meth) ⇒ Object
Returns an array of the file and line number at which a method starts using a method
44 45 46 |
# File 'lib/boson/more_method_inspector.rb', line 44 def find_method_locations(mod, meth) mod.instance_method(meth).source_location end |
#has_inspector_method?(meth, inspector) ⇒ Boolean
37 38 39 40 |
# File 'lib/boson/more_method_inspector.rb', line 37 def has_inspector_method?(meth, inspector) (store[inspector] && store[inspector].key?(meth.to_s)) || inspector_in_file?(meth.to_s, inspector) end |
#set_arguments(mod, meth) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/boson/more_method_inspector.rb', line 27 def set_arguments(mod, meth) store[:args] ||= {} file = find_method_locations(mod, meth)[0] if File.exists?(file) body = File.read(file) store[:args][meth.to_s] = self.class.scrape_arguments body, meth end end |