Sha256: eea215f0b776452613f5f8900011459dbdfa92e7db0f9ae4ab6ffd116be6d0ac
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
require 'rib/core/history_file' module Rib::SqueezeHistory include Rib::Plugin Shell.use(self) # squeeze history on memory too def eval_input input return super if SqueezeHistory.disabled? history.pop if input.strip == '' || (history.size > 1 && input == history.to_a[-2]) # EditLine is really broken, to_a is needed for it super end # write squeezed history def write_history return super if SqueezeHistory.disabled? @history = P.squeeze_history(history) super end module Imp def squeeze_history history history.to_a.inject([]){ |result, item| if result.last == item || item.strip == '' result else result << item end } end end Plugin.extend(Imp) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rib-0.1.0 | lib/rib/more/squeeze_history.rb |