class Pry::Command::Hist

def check_for_juxtaposed_replay(replay_sequence)

Returns:
  • (Boolean) - `false` if +replay_sequence+ does not contain another

Parameters:
  • replay_sequence (String) -- The sequence of commands to be replayed

Raises:
  • (Pry::CommandError) - If +replay_sequence+ contains another
def check_for_juxtaposed_replay(replay_sequence)
  if replay_sequence =~ /\Ahist(?:ory)?\b/
    # Create *fresh* instance of Options for parsing of "hist" command.
    slop_instance = slop
    slop_instance.parse(replay_sequence.split(' ')[1..-1])
    if slop_instance.present?(:r)
      replay_sequence = replay_sequence.split("\n").join('; ')
      index = opts[:r]
      index = index.min if index.min == index.max || index.max.nil?
      raise CommandError,
            "Replay index #{index} points out to another replay call: " \
            "`#{replay_sequence}`"
    end
  else
    false
  end
end