class Pry::BlockCommand

A super-class for Commands that are created with a single block.

This class ensures that the block is called with the correct number of arguments and the right context.

Create subclasses using {Pry::CommandSet#command}.

Public Instance Methods

call(*args) click to toggle source

Call the block that was registered with this command. @param [Array<String>] args The arguments passed @return [Object] The return value of the block

# File lib/pry/command.rb, line 491
def call(*args)
  instance_exec(*correct_arg_arity(block.arity, args), &block)
end
help() click to toggle source
# File lib/pry/command.rb, line 495
def help
  "#{command_options[:listing].to_s.ljust(18)} #{description}"
end