Module: ModuleExtensions::InstanceMethodVisibility

Included in:
Module
Defined in:
lib/module_extensions/instance_method_visibility.rb,
lib/module_extensions/instance_method_visibility.rb

Overview

class Module

Instance Method Summary collapse

Instance Method Details

#instance_method_visibility(name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/module_extensions/instance_method_visibility.rb', line 10

def instance_method_visibility(name)
  if private_method_defined?(name)
    :private
  elsif protected_method_defined?(name)
    :protected
  elsif public_method_defined?(name)
    :public
  else
    raise(NoMethodError,
          "`#{name}' - not an instance method of `#{self.name}'")
  end
end