Module: Ripl::Rc::SqueezeHistory

Includes:
U
Defined in:
lib/ripl/rc/squeeze_history.rb

Defined Under Namespace

Modules: Imp

Instance Method Summary collapse

Methods included from U

included

Methods included from Imp

#squeeze_history

Methods included from Ripl::Rc::StripBacktrace::Imp

#cwd, #home, #snip, #strip_backtrace

Methods included from Anchor::Imp

#short_inspect

Methods included from Color::Imp

#black, #blue, #color, #colors, #cyan, #find_color, #green, #magenta, #red, #reset, #white, #yellow

Instance Method Details

#eval_input(input) ⇒ Object

squeeze history on memory too



15
16
17
18
19
20
21
# File 'lib/ripl/rc/squeeze_history.rb', line 15

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_historyObject

write squeezed history



8
9
10
11
12
# File 'lib/ripl/rc/squeeze_history.rb', line 8

def write_history
  return super if SqueezeHistory.disabled?
  @history = [U.squeeze_history(history).join("\n") + "\n"]
  super
end