Sha256: 45b7c7c53999cf025b67c1598ff4a2bea3f7d13753ec8b9d7e70d85c38a8511d

Contents?: true

Size: 1.32 KB

Versions: 28

Compression:

Stored size: 1.32 KB

Contents

class Pry
  # Command contexts are the objects runing each command.
  # Helper modules can be mixed into this class.
  class CommandContext

    # represents a void return value for a command
    VOID_VALUE = Object.new

    # give it a nice inspect
    def VOID_VALUE.inspect() "void" end

    attr_accessor :command_name
    attr_accessor :output
    attr_accessor :target
    attr_accessor :target_self
    attr_accessor :captures
    attr_accessor :eval_string
    attr_accessor :arg_string
    attr_accessor :opts
    attr_accessor :command_set
    attr_accessor :command_processor
    attr_accessor :_pry_

    # Run a command from another command.
    # @param [String] command_string The string that invokes the command
    # @param [Array] args Further arguments to pass to the command
    # @example
    #   run "show-input"
    # @example
    #   run ".ls"
    # @example
    #   run "amend-line",  "5", 'puts "hello world"'
    def run(command_string, *args)
      complete_string = "#{command_string} #{args.join(" ")}"
      command_processor.process_commands(complete_string, eval_string, target)
    end

    def commands
      command_set.commands
    end

    def text
      Pry::Helpers::Text
    end

    def void
      VOID_VALUE
    end

    include Pry::Helpers::BaseHelpers
    include Pry::Helpers::CommandHelpers
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
pry-0.9.8pre2 lib/pry/command_context.rb
pry-0.9.8pre2-i386-mswin32 lib/pry/command_context.rb
pry-0.9.8pre2-i386-mingw32 lib/pry/command_context.rb
pry-0.9.8pre2-java lib/pry/command_context.rb
pry-0.9.8.0pre1-i386-mswin32 lib/pry/command_context.rb
pry-0.9.8.0pre1-i386-mingw32 lib/pry/command_context.rb
pry-0.9.7.4 lib/pry/command_context.rb
pry-0.9.7.4-i386-mswin32 lib/pry/command_context.rb
pry-0.9.7.4-i386-mingw32 lib/pry/command_context.rb
pry-0.9.7.4-java lib/pry/command_context.rb
pry-0.9.7.3 lib/pry/command_context.rb
pry-0.9.7.3-i386-mswin32 lib/pry/command_context.rb
pry-0.9.7.3-i386-mingw32 lib/pry/command_context.rb
pry-0.9.7.3-java lib/pry/command_context.rb
pry-0.9.7.2 lib/pry/command_context.rb
pry-0.9.7.2-i386-mswin32 lib/pry/command_context.rb
pry-0.9.7.2-i386-mingw32 lib/pry/command_context.rb
pry-0.9.7.2-java lib/pry/command_context.rb
pry-0.9.7.1 lib/pry/command_context.rb
pry-0.9.7.1-i386-mswin32 lib/pry/command_context.rb