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)
|
def command_matched(val, target)
|
||||||
_, cmd_data = commands.commands.find do |name, data|
|
_, cmd_data = commands.commands.find do |name, data|
|
||||||
|
|
||||||
interp_val = interpolate_string(val, target)
|
|
||||||
command_regex = /^#{convert_to_regex(name)}(?!\S)/
|
command_regex = /^#{convert_to_regex(name)}(?!\S)/
|
||||||
|
|
||||||
if data.options[:interpolate] && (command_regex =~ interp_val)
|
if data.options[:interpolate]
|
||||||
val.replace interp_val
|
# 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
|
else
|
||||||
command_regex =~ val
|
command_regex =~ val
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue