Module: Rib::SqueezeHistory
- Extended by:
- Plugin
- Defined in:
- lib/rib/core/squeeze_history.rb
Instance Attribute Summary
Attributes included from Plugin
Instance Method Summary collapse
-
#loop_once ⇒ Object
squeeze history in memory too.
-
#write_history ⇒ Object
write squeezed history.
Methods included from Plugin
const_missing, disable, disabled?, enable, enabled?, extended
Instance Method Details
#loop_once ⇒ Object
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_history ⇒ Object
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 |