Sha256: 8b4e97e9698227e074ecfdc9b9a81f22ea521b897eb0eaf71d1842f975411b0b
Contents?: true
Size: 864 Bytes
Versions: 1
Compression:
Stored size: 864 Bytes
Contents
require 'ripl' module Ripl::Rc; end module Ripl::Rc::SqueezeHistory include Ripl::Rc # makes U avaliable # write squeezed history def write_history File.open(history_file, 'w'){ |f| f.puts U.squeeze_history(history).join("\n") } end # squeeze history on memory too def eval_input input history.pop if input.strip == '' || (history.size > 1 && input == history[-2]) super end def before_loop super if history.empty? end module Imp def squeeze_history history history.to_a.inject([]){ |result, item| if result.last == item result else result << item end }.last(Ripl.config[:rc_squeeze_history_size] ||= 500) end end end module Ripl::Rc::U; extend Ripl::Rc::SqueezeHistory::Imp; end Ripl::Shell.include(Ripl::Rc::SqueezeHistory)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ripl-rc-0.1.2 | lib/ripl/rc/squeeze_history.rb |