Sha256: 9d3f4099145434b07fe46475d1ffac17a00238eb49605343227283b2558abfae

Contents?: true

Size: 856 Bytes

Versions: 2

Compression:

Stored size: 856 Bytes

Contents

module Byebug
  #
  # Reopens the +info+ command to define the +args+ subcommand
  #
  class InfoCommand < Command
    #
    # Information about arguments of the current method/block
    #
    class ArgsSubcommand < Command
      def regexp
        /^\s* a(?:rgs)? \s*$/x
      end

      def execute
        locals = @state.context.frame_locals
        args = @state.context.frame_args
        return if args == [[:rest]]

        args.map do |_, name|
          s = "#{name} = #{locals[name].inspect}"
          s[Setting[:width] - 3..-1] = '...' if s.size > Setting[:width]
          puts s
        end
      end

      def short_description
        'Information about arguments of the current method/block'
      end

      def description
        <<-EOD
          inf[o] a[args]

          #{short_description}
        EOD
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/byebug-5.0.0/lib/byebug/commands/info/args.rb
byebug-5.0.0 lib/byebug/commands/info/args.rb