1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Define Options creation more exactly

Sometimes I have a failing test, because it can't find Options constant.
Let's help Ruby in its hard job a bit.

Also, reformulate some comments and convert " to ' in some places.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
This commit is contained in:
Kyrylo Silin 2012-11-21 15:22:39 +02:00
parent 50722e298b
commit 892ade1c0f

View file

@ -105,6 +105,9 @@ class Pry
@history = @history.between(opts[:r])
replay_sequence = @history.raw
# If we met follow-up "hist" call, check for the "--replay" option
# presence. If "hist" command is called with other options, proceed
# further.
check_for_juxtaposed_replay(replay_sequence)
_pry_.input_stack.push _pry_.input
@ -113,9 +116,8 @@ class Pry
# run "show-input" unless _pry_.complete_expression?(eval_string)
end
# If we met another an extra "hist" call to be replayed, check for the
# "--replay" option presence. If "hist" command is called with other options
# then proceed further. Example:
# Checks +replay_sequence+ for the presence of neighboring replay calls.
# @example
# [1] pry(main)> hist --show 46894
# 46894: hist --replay 46675..46677
# [2] pry(main)> hist --show 46675..46677
@ -135,11 +137,11 @@ class Pry
def check_for_juxtaposed_replay(replay_sequence)
if replay_sequence =~ /\Ahist(?:ory)?\b/
# Create *fresh* instance of Options for parsing of "hist" command.
_slop = Options.new(self.slop)
_slop.parse replay_sequence.split(" ")[1..-1]
_slop = ClassCommand::Options.new(self.slop)
_slop.parse replay_sequence.split(' ')[1..-1]
if _slop.present?(:r)
replay_sequence = replay_sequence.split("\n").join("; ")
replay_sequence = replay_sequence.split("\n").join('; ')
index = opts[:r]
index = index.min if index.min == index.max