accept_eof -> accept_line(nil)

This commit is contained in:
Conrad Irwin 2012-12-20 23:58:58 -08:00
parent 9d48aba5b8
commit 37b2f20a34
3 changed files with 8 additions and 7 deletions

View File

@ -235,11 +235,12 @@ class Pry
@eval_string = ""
end
def accept_eof
Pry.config.control_d_handler.call(@eval_string, self)
end
def accept_line(line)
if line.nil?
Pry.config.control_d_handler.call(@eval_string, self)
return
end
@suppress_output = false
inject_sticky_locals!
ensure_correct_encoding!(line)

View File

@ -56,7 +56,7 @@ class Pry
pry.reset_line
when :end_of_file
output.puts "" if output.tty?
pry.accept_eof
pry.accept_line nil
else
pry.accept_line val
end

View File

@ -21,7 +21,7 @@ describe Pry::DEFAULT_CONTROL_D_HANDLER do
instance.binding_stack.should.not.be.empty
called = false
catch(:breakout) {
instance.accept_eof
instance.accept_line(nil)
called = true
}
called.should == false
@ -34,7 +34,7 @@ describe Pry::DEFAULT_CONTROL_D_HANDLER do
t = pry_tester
t.eval "cd Object.new"
t.eval("_pry_.binding_stack.size").should == 2
t.eval("_pry_.accept_eof")
t.eval("_pry_.accept_line(nil)")
t.eval("_pry_.binding_stack.size").should == 1
end
end