Sha256: 05f058e095eec44696b32600f8ae4fba4e7ea8ab5e34abd61f1e00b2b96233aa

Contents?: true

Size: 1.2 KB

Versions: 15

Compression:

Stored size: 1.2 KB

Contents

require 'pry/commands/ls/jruby_hacks'

module Pry::Command::Ls::MethodsHelper

  include Pry::Command::Ls::JRubyHacks

  private

  # Get all the methods that we'll want to output.
  def all_methods(instance_methods = false)
    methods = if instance_methods || @instance_methods_switch
                Pry::Method.all_from_class(@interrogatee)
              else
                Pry::Method.all_from_obj(@interrogatee)
              end

    if Pry::Helpers::Platform.jruby? && !@jruby_switch
      methods = trim_jruby_aliases(methods)
    end

    methods.select { |method| @ppp_switch || method.visibility == :public }
  end

  def resolution_order
    if @instance_methods_switch
      Pry::Method.instance_resolution_order(@interrogatee)
    else
      Pry::Method.resolution_order(@interrogatee)
    end
  end

  def format(methods)
    methods.sort_by(&:name).map do |method|
      if method.name == 'method_missing'
        color(:method_missing, 'method_missing')
      elsif method.visibility == :private
        color(:private_method, method.name)
      elsif method.visibility == :protected
        color(:protected_method, method.name)
      else
        color(:public_method, method.name)
      end
    end
  end

end

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb
pry-0.12.2-java lib/pry/commands/ls/methods_helper.rb
pry-0.12.2 lib/pry/commands/ls/methods_helper.rb
pry-0.12.1 lib/pry/commands/ls/methods_helper.rb
pry-0.12.1-java lib/pry/commands/ls/methods_helper.rb
pry-0.12.0 lib/pry/commands/ls/methods_helper.rb
pry-0.12.0-java lib/pry/commands/ls/methods_helper.rb