Module: Nirvana::Shell

Defined in:
lib/nirvana/shell.rb

Instance Method Summary collapse

Instance Method Details

#format_result(result) ⇒ Object



28
29
30
31
32
# File 'lib/nirvana/shell.rb', line 28

def format_result(result)
  output = Util.format_output @stdout + super
  output = "<div class='nirvana_warning'>#{@stderr}</div>" + output unless @stderr.to_s.empty?
  output
end

#loop_eval(str) ⇒ Object



19
20
21
22
# File 'lib/nirvana/shell.rb', line 19

def loop_eval(str)
  @stdout, @stderr, result = Util.capture_all { super(str) }
  result
end


24
25
26
# File 'lib/nirvana/shell.rb', line 24

def print_eval_error(error)
  @eval_error = html_error(error, '')
end


15
16
17
# File 'lib/nirvana/shell.rb', line 15

def print_result(result)
  @eval_error || format_result(@result)
end

#web_loop_once(input) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/nirvana/shell.rb', line 6

def web_loop_once(input)
  super
  @eval_error = nil
  @input[/^:AUTOCOMPLETE:/] ? get_completions(@input) : loop_once
rescue Exception => e
  exit if e.message[/^uncaught throw `ripl_exit'/]
  html_error(e, "Internal #{@name} error: ")
end