Class: Pry::Command::Ls::SelfMethods

Inherits:
Formatter show all
Includes:
Interrogatable, MethodsHelper
Defined in:
lib/pry/commands/ls/self_methods.rb

Instance Attribute Summary

Attributes inherited from Formatter

#grep, #pry_instance

Instance Method Summary collapse

Methods included from MethodsHelper

#all_methods, #format, #resolution_order

Methods included from JRubyHacks

#rubbishness, #trim_jruby_aliases

Methods included from Interrogatable

#interrogatee_mod, #interrogating_a_module?

Methods inherited from Formatter

#color, #format_value, #output_section, #write_out

Constructor Details

#initialize(interrogatee, no_user_opts, opts, pry_instance) ⇒ SelfMethods

Returns a new instance of SelfMethods.


10
11
12
13
14
15
16
# File 'lib/pry/commands/ls/self_methods.rb', line 10

def initialize(interrogatee, no_user_opts, opts, pry_instance)
  super(pry_instance)
  @interrogatee = interrogatee
  @no_user_opts = no_user_opts
  @ppp_switch = opts[:ppp]
  @jruby_switch = opts['all-java']
end

Instance Method Details

#correct_opts?Boolean (private)

Returns:

  • (Boolean)

28
29
30
# File 'lib/pry/commands/ls/self_methods.rb', line 28

def correct_opts?
  @no_user_opts && interrogating_a_module?
end

#output_selfObject


18
19
20
21
22
23
24
# File 'lib/pry/commands/ls/self_methods.rb', line 18

def output_self
  methods = all_methods(true).select do |m|
    m.owner == @interrogatee && grep.regexp[m.name]
  end
  heading = "#{Pry::WrappedModule.new(@interrogatee).method_prefix}methods"
  output_section(heading, format(methods))
end