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
47
48
|
# 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_inner_loop_value = catch(:exit_inner_loop) do
loop do begin
catch(:skip_process_input) do
before_input if respond_to? :before_input
if block_given?
yield self.gets
elsif respond_to? :process_input
process_input(self.gets)
else
puts self.gets
end
end
ensure
after_input if respond_to? :after_input
end
end
end
return if exit_inner_loop_value == :exit
ensure
teardown if respond_to? :teardown
end
end
ensure
IRB::HistorySavingAbility.save_history
end
|