Class: Ripl::ReadlineShell
Constant Summary
Constants inherited
from Shell
Shell::OPTIONS
Instance Attribute Summary
Attributes inherited from Shell
#binding, #line, #result_prompt
Instance Method Summary
collapse
Methods included from Completion
#start_completion
Methods inherited from Shell
#format_error, #format_result, #initialize, #loop, #loop_once, #print_eval_error
Constructor Details
This class inherits a constructor from Ripl::Shell
Instance Method Details
#after_loop ⇒ Object
22
23
24
|
# File 'lib/ripl/readline_shell.rb', line 22
def after_loop
File.open(history_file, 'w') {|f| f.write Readline::HISTORY.to_a.join("\n") }
end
|
#before_loop ⇒ Object
15
16
17
18
19
20
|
# File 'lib/ripl/readline_shell.rb', line 15
def before_loop
start_completion
super
File.exists?(history_file) &&
IO.readlines(history_file).each {|e| Readline::HISTORY << e.chomp }
end
|
7
8
9
|
# File 'lib/ripl/readline_shell.rb', line 7
def get_input
Readline.readline @options[:prompt], true
end
|
#history_file ⇒ Object
11
12
13
|
# File 'lib/ripl/readline_shell.rb', line 11
def history_file
@history_file ||= File.expand_path(@options[:history])
end
|