mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Made sure completions proc do not return nil
The completion proc returning nil causes errors in input systems that only expect strings (e.g. Coolline).
This commit is contained in:
parent
dac10c6437
commit
2fe52d6e75
2 changed files with 16 additions and 13 deletions
|
@ -260,7 +260,7 @@ class Pry
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.select_message(path, receiver, message, candidates)
|
def self.select_message(path, receiver, message, candidates)
|
||||||
candidates.grep(/^#{message}/).collect do |e|
|
candidates.grep(/^#{message}/).collect { |e|
|
||||||
case e
|
case e
|
||||||
when /^[a-zA-Z_]/
|
when /^[a-zA-Z_]/
|
||||||
path.call(receiver + "." + e)
|
path.call(receiver + "." + e)
|
||||||
|
@ -268,7 +268,7 @@ class Pry
|
||||||
when *Operators
|
when *Operators
|
||||||
#receiver + " " + e
|
#receiver + " " + e
|
||||||
end
|
end
|
||||||
end
|
}.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
# build_path seperates the input into two parts: path and input.
|
# build_path seperates the input into two parts: path and input.
|
||||||
|
@ -293,4 +293,3 @@ class Pry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -226,4 +226,8 @@ describe Pry::InputCompleter do
|
||||||
completer_test(b, pry).call('/Con')
|
completer_test(b, pry).call('/Con')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should not return nil in its output' do
|
||||||
|
pry = Pry.new
|
||||||
|
new_completer(binding, pry).call("pry.").should.not.include nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue