Module: Rib::SqueezeHistory

Extended by:
Plugin
Defined in:
lib/rib/core/squeeze_history.rb

Instance Attribute Summary

Attributes included from Plugin

#disabled

Instance Method Summary collapse

Methods included from Plugin

const_missing, disable, disabled?, enable, enabled?, extended

Instance Method Details

#loop_onceObject

squeeze history in memory too



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rib/core/squeeze_history.rb', line 11

def loop_once
  return super if SqueezeHistory.disabled?
  begin
    input, last_input = history[-1], history[-2]
  rescue IndexError # EditLine is really broken, to_a is needed for it
    array = history.to_a
    input, last_input = array[-1], array[-2]
  end
  history.pop if input.to_s.strip == '' ||
                (history.size > 1 && input == last_input)
  super
end

#write_historyObject

write squeezed history



27
28
29
30
31
# File 'lib/rib/core/squeeze_history.rb', line 27

def write_history
  return super if SqueezeHistory.disabled?
  config[:history] = squeezed_history
  super
end