Module: Ripl::Rc::MultilineHistory

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

Instance Method Summary collapse

Methods included from U

included

Methods included from SqueezeHistory::Imp

#squeeze_history

Methods included from 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

#handle_interruptObject



20
21
22
23
24
25
26
27
# File 'lib/ripl/rc/multiline_history.rb', line 20

def handle_interrupt
  return super if MultilineHistory.disabled?
  unless @rc_multiline_buffer.empty?
    @rc_multiline_trash ||= 0
    @rc_multiline_trash  += 1
  end
  super
end

#loop_eval(input) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ripl/rc/multiline_history.rb', line 8

def loop_eval(input)
  return super if MultilineHistory.disabled?
  super # might throw
ensure
  unless @rc_multiline_buffer.empty?
    (@rc_multiline_buffer.size + (@rc_multiline_trash || 0)).
      times{ history.pop }
     @rc_multiline_trash = 0
    history << "\n" + @rc_multiline_buffer.join("\n")
  end
end