Module: Gisele::VM::Console::Handler

Defined in:
lib/gisele/vm/console.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#interactiveObject

Returns the value of attribute interactive.



6
7
8
# File 'lib/gisele/vm/console.rb', line 6

def interactive
  @interactive
end

Instance Method Details

#notify_readableObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gisele/vm/console.rb', line 7

def notify_readable
  case s = @io.readline.strip
  when /^l(ist)?$/           then interactive.list_action
  when /^n(ew)?\s+(.+)$/     then interactive.new_action($2)
  when /^r(esume)?\s+(.+)$/  then interactive.resume_action($2)
  when /^q(uit)?$/           then interactive.stop_action
  else
    puts "Unrecognized: #{s}" unless s.empty?
  end
rescue Exception => ex
  puts "ERROR: #{ex.message}"
ensure
  interactive.prompt if interactive.connected?
end