class Mmmm::ObjectMethod
Public Class Methods
new(obj, method_name)
click to toggle source
# File lib/mmmm/object_method.rb, line 3 def initialize obj, method_name ancs = all_ancestors(obj) @locs_in_all_ancs = instance_method_locations(method_name, ancs) end
Public Instance Methods
inspect()
click to toggle source
# File lib/mmmm/object_method.rb, line 8 def inspect @locs_in_all_ancs. map{ |file, line| [file.cyan, line].join(' ') }. join("\n") end
Private Instance Methods
all_ancestors(obj)
click to toggle source
# File lib/mmmm/object_method.rb, line 16 def all_ancestors obj obj. singleton_class. ancestors end
instance_method_location(method_name, mod)
click to toggle source
# File lib/mmmm/object_method.rb, line 30 def instance_method_location method_name, mod mod.instance_method(method_name).source_location rescue NameError => e nil end
instance_method_locations(method_name, mods)
click to toggle source
# File lib/mmmm/object_method.rb, line 22 def instance_method_locations method_name, mods mods.each_with_object([]) do |class_or_module, locs| loc = instance_method_location method_name, class_or_module locs << loc unless loc.nil? end. uniq end