Class: QuickQueue::Console
- Includes:
- Readline
- Defined in:
- lib/quick_queue/console.rb
Instance Method Summary collapse
Methods inherited from Client
#fetch, #handle, #initialize, #push, #server_status
Constructor Details
This class inherits a constructor from QuickQueue::Client
Instance Method Details
#loop ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/quick_queue/console.rb', line 6 def loop while (command = readline('> ', true)).chomp != 'exit' next if command == '' method, *args = command.split(' ') if ['status', 'server_status', 'fetch', 'push', 'pop'].include?(method) eval "puts(#{method} #{args.join(' ')})" rescue $stdout.puts($!.) else puts "No such command - #{method}" end end puts 'Bye' end |