18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/easy_repl/repl.rb', line 18
def start
IRB::HistorySavingAbility.extend(IRB::HistorySavingAbility) unless IRB::HistorySavingAbility === IRB::HistorySavingAbility
loop do
setup if respond_to? :setup
begin
exit_value = catch(:exit_repl) do
loop do
begin
before_input if respond_to? :before_input
if block_given?
yield EasyRepl.gets
elsif respond_to? :process_input
process_input(EasyRepl.gets)
else
puts EasyRepl.gets
end
ensure
after_input if respond_to? :after_input
end
end
end
return if exit_value == :exit
ensure
teardown if respond_to? :teardown
end
end
ensure
IRB::HistorySavingAbility.save_history
end
|