mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
trying to fix interpolation
This commit is contained in:
parent
2e2bc9b136
commit
be9b77d6a9
1 changed files with 10 additions and 3 deletions
|
@ -55,11 +55,18 @@ class Pry
|
|||
def command_matched(val, target)
|
||||
_, cmd_data = commands.commands.find do |name, data|
|
||||
|
||||
interp_val = interpolate_string(val, target)
|
||||
command_regex = /^#{convert_to_regex(name)}(?!\S)/
|
||||
|
||||
if data.options[:interpolate] && (command_regex =~ interp_val)
|
||||
val.replace interp_val
|
||||
if data.options[:interpolate]
|
||||
# If interpolation fails then the command cannot be matched,
|
||||
# so early exit.
|
||||
begin
|
||||
interp_val = interpolate_string(val, target)
|
||||
rescue NameError
|
||||
return nil
|
||||
end
|
||||
|
||||
val.replace interp_val if command_regex =~ interp_val
|
||||
else
|
||||
command_regex =~ val
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue