Method: Pry::Method#visibility

Defined in:
lib/pry/method.rb

#visibilitySymbol

Returns The visibility of the method. May be ‘:public`, `:protected`, or `:private`.

Returns:

  • (Symbol)

    The visibility of the method. May be ‘:public`, `:protected`, or `:private`.



373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/pry/method.rb', line 373

def visibility
  @visibility ||=
    if owner.public_instance_methods.any? { |m| m.to_s == name }
      :public
    elsif owner.protected_instance_methods.any? { |m| m.to_s == name }
      :protected
    elsif owner.private_instance_methods.any? { |m| m.to_s == name }
      :private
    else
      :none
    end
end