module Ripl::AutoIndent

Constants

TPUT
VERSION

Public Instance Methods

before_loop() click to toggle source
Calls superclass method
# File lib/ripl/auto_indent.rb, line 14
def before_loop
  @current_indent = 0
  super
end
loop_eval(input) click to toggle source
Calls superclass method
# File lib/ripl/auto_indent.rb, line 34
def loop_eval(input)
  last_indent     = ( @current_indent ||= 0 )
  @current_indent = RubyIndentation[ @buffer ? @buffer*";"+";"+input : input ]

  if config[:auto_indent_rewrite] && @current_indent < last_indent
    rewrite_line last_indent - @current_indent
  end

  super # (@buffer ? @buffer + input : input)
end
prompt() click to toggle source
Calls superclass method
# File lib/ripl/auto_indent.rb, line 19
def prompt
  @buffer ? super + config[:auto_indent_space]*@current_indent : super
end
rewrite_line(append_indents = 0) click to toggle source
# File lib/ripl/auto_indent.rb, line 23
def rewrite_line(append_indents = 0)
  print_method = defined?(Ripl::ColorStreams) ? :real_write : :write
  $stdout.send print_method,
    TPUT[:sc] +
    TPUT[:cuu1] +
    prompt + 
    @input +
    config[:auto_indent_space]*append_indents +
    TPUT[:rc]
end