class Pry::CommandSet

def []=(pattern, command)

Returns:
  • (Pry::Command) -

Parameters:
  • command (Pry::Command) --
  • pattern (Regexp, String) --
def []=(pattern, command)
  if command.equal?(nil)
    @commands.delete(pattern)
    return
  end
  unless command.is_a?(Class) && command < Pry::Command
    raise TypeError, "command is not a subclass of Pry::Command"
  end
  bind_command_to_pattern = pattern != command.match
  if bind_command_to_pattern
    command_copy = command.dup
    command_copy.match = pattern
    @commands[pattern] = command_copy
  else
    @commands[pattern] = command
  end
end