Skip to content
Browse files

can now specify fallback input object in case no rules matched

  • Loading branch information...
1 parent 30f54d6 commit af8baa02c415fb8bede6b094faed8a5cbc3cbbc7 @banister banister committed Jul 26, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/pry-autopilot.rb
View
5 lib/pry-autopilot.rb
@@ -16,8 +16,9 @@ def on(predicate, &block)
attr_accessor :input
- def initialize
+ def initialize(fallback_input=Readline)
@input = Input.new
+ @fallback_input = fallback_input
@fibers = []
end
@@ -34,7 +35,7 @@ def readline(prompt)
@current_fiber = @fibers.shift if !@current_fiber || !@current_fiber.alive?
@current_fiber.resume(input)
else
- Readline.readline(prompt)
+ @fallback_input.readline(prompt)
end
end

0 comments on commit af8baa0

Please sign in to comment.
Something went wrong with that request. Please try again.