Sha256: 1aa2569820e3fdc90cc38080a0c707c13b506c53d8457f9a655ae13c1cc35ca0

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

class Pry
  class Command::Stat < Pry::ClassCommand
    match 'stat'
    group 'Introspection'
    description 'View method information and set _file_ and _dir_ locals.'
    command_options shellwords: false

    banner <<-'BANNER'
        Usage: stat [OPTIONS] [METH]

        Show method information for method METH and set _file_ and _dir_ locals.

        stat hello_method
    BANNER

    def options(opt)
      method_options(opt)
    end

    def process
      meth = method_object
      aliases = meth.aliases

      output.puts unindent <<-EOS
        Method Information:
        --
        Name: #{meth.name}
        Alias#{ "es" if aliases.length > 1 }: #{ aliases.any? ? aliases.join(", ") : "None." }
        Owner: #{meth.owner ? meth.owner : "Unknown"}
        Visibility: #{meth.visibility}
        Type: #{meth.is_a?(::Method) ? "Bound" : "Unbound"}
        Arity: #{meth.arity}
        Method Signature: #{meth.signature}
        Source Location: #{meth.source_location ? meth.source_location.join(":") : "Not found."}
      EOS
    end
  end

  Pry::Commands.add_command(Pry::Command::Stat)
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/stat.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/commands/stat.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/commands/stat.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/stat.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/commands/stat.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/stat.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/commands/stat.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/stat.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/commands/stat.rb
pry-0.12.2-java lib/pry/commands/stat.rb
pry-0.12.2 lib/pry/commands/stat.rb
pry-0.12.1 lib/pry/commands/stat.rb
pry-0.12.1-java lib/pry/commands/stat.rb
pry-0.12.0 lib/pry/commands/stat.rb
pry-0.12.0-java lib/pry/commands/stat.rb