Module: Spy::DetermineVisibility
- Defined in:
- lib/spy/determine_visibility.rb
Class Method Summary collapse
Class Method Details
.call(method) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/spy/determine_visibility.rb', line 5 def self.call(method) owner = method.owner %w(public private protected).each do |vis| query = "#{vis}_method_defined?" if owner.respond_to?(query) && owner.send(query, method.name) return vis end end raise NoMethodError, "couldn't find method #{method.name} belonging to #{owner}" end |