Sha256: 3d1df92f431a78e8236969daecbad47c639e8e44b77275eb714c66a0279c59fb

Contents?: true

Size: 1.18 KB

Versions: 6796

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

class Pry
  class Command
    class 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(<<-OUTPUT))
          Method Information:
          --
          Name: #{meth.name}
          Alias#{'es' if aliases.length > 1}: #{aliases.any? ? aliases.join(', ') : 'None.'}
          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.'}
        OUTPUT
      end
    end

    Pry::Commands.add_command(Pry::Command::Stat)
  end
end

Version data entries

6,796 entries across 6,792 versions & 31 rubygems

Version Path
cybrid_api_organization_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_bank_ruby-0.123.142 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.142 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_organization_ruby-0.123.142 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_bank_ruby-0.123.140 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.140 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_organization_ruby-0.123.140 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_bank_ruby-0.123.139 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.139 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_organization_ruby-0.123.139 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.137 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_organization_ruby-0.123.137 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_bank_ruby-0.123.137 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_organization_ruby-0.123.135 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_bank_ruby-0.123.135 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.135 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_bank_ruby-0.123.134 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_id_ruby-0.123.134 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb
cybrid_api_organization_ruby-0.123.134 vendor/bundle/ruby/3.3.0/gems/pry-0.14.2/lib/pry/commands/stat.rb