class RSpec::Mocks::MethodReference
def self.method_visibility_for(object, method_name)
def self.method_visibility_for(object, method_name) instance_method_visibility_for(class << object; self; end, method_name).tap do |vis| # If the method is not defined on the class, `instance_method_visibility_for` # returns `nil`. However, it may be handled dynamically by `method_missing`, # so here we check `respond_to` (passing false to not check private methods). # # This only considers the public case, but I don't think it's possible to # write `method_missing` in such a way that it handles a dynamic message # with private or protected visibility. Ruby doesn't provide you with # the caller info. return :public if vis.nil? && object.respond_to?(method_name, false) end end