summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert <therobot.johnny5@gmail.com>2014-04-03 02:44:20 +0200
committerRyan Fitzgerald <rwfitzge@gmail.com>2014-04-27 14:13:37 -0700
commit7e612a3156e840a517627780d4e03a893b669b4e (patch)
treeb6635d39410d68458bd1e308945e4924aecd2646
parentf569d3b119a4a1b38839767404a123037de2b415 (diff)
downloadpry-7e612a3156e840a517627780d4e03a893b669b4e.tar.gz
pass the right 'input' to InputCompleter#call, improve docs.
-rw-r--r--lib/pry/input_completer.rb10
-rw-r--r--lib/pry/pry_instance.rb17
2 files changed, 15 insertions, 12 deletions
diff --git a/lib/pry/input_completer.rb b/lib/pry/input_completer.rb
index e415d175..be564841 100644
--- a/lib/pry/input_completer.rb
+++ b/lib/pry/input_completer.rb
@@ -48,15 +48,14 @@ class Pry::InputCompleter
@input.completion_append_character = nil if @input.respond_to?(:completion_append_character=)
end
+ #
# Return a new completion proc for use by Readline.
- # @param [Binding] input The current binding context.
- # @param [Array<String>] options The array of Pry commands.
- def call(input, options)
+ #
+ def call(str, options = {})
custom_completions = options[:custom_completions] || []
-
# if there are multiple contexts e.g. cd 1/2/3
# get new target for 1/2 and find candidates for 3
- path, input = build_path(input)
+ path, input = build_path(str)
if path.call.empty?
target = options[:target]
@@ -235,5 +234,4 @@ class Pry::InputCompleter
end
return path, input
end
-
end
diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb
index 28698479..cc9582b2 100644
--- a/lib/pry/pry_instance.rb
+++ b/lib/pry/pry_instance.rb
@@ -121,15 +121,20 @@ class Pry
binding_stack << Pry.binding_for(object)
end
+ #
# Generate completions.
- # @param [String] input What the user has typed so far
- # @return [Array<String>] Possible completions
- def complete(input)
+ #
+ # @param [String] input
+ # What the user has typed so far
+ #
+ # @return [Array<String>]
+ # Possible completions
+ #
+ def complete(str)
return EMPTY_COMPLETIONS unless config.completer
Pry.critical_section do
- completer = config.completer.new(input, self)
- # todo: `input` argument isn't needed.
- completer.call input, target: current_binding, custom_completions: custom_completions.call.push(*sticky_locals.keys)
+ completer = config.completer.new(config.input, self)
+ completer.call str, target: current_binding, custom_completions: custom_completions.call.push(*sticky_locals.keys)
end
end