Sha256: 80edd1e40f872575b6764ac9ae6d067c7ff984205bd6e0909a2503e1a042e0c3
Contents?: true
Size: 623 Bytes
Versions: 3
Compression:
Stored size: 623 Bytes
Contents
module Ripl::History def history_file @history_file ||= File.expand_path(config[:history]) end def history() @history ||= [] end def get_input (history << super)[-1] end def read_history File.exists?(history_file) && history.empty? && IO.readlines(history_file).each {|e| history << e.chomp } end def write_history File.open(history_file, 'w') {|f| f.write Array(history).join("\n") } end def before_loop() super; read_history end def after_loop() super; write_history end end Ripl::Shell.include Ripl::History Ripl.config[:history] = ENV['RIPL_HISTORY'] || '~/.irb_history'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ripl-0.6.4 | lib/ripl/history.rb |
ripl-0.6.3 | lib/ripl/history.rb |
ripl-0.6.2 | lib/ripl/history.rb |