Class: Controlio::Client
- Inherits:
-
Object
- Object
- Controlio::Client
- Defined in:
- lib/controlio/client.rb
Constant Summary collapse
- POLL_DELAY =
5
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/controlio/client.rb', line 11 def initialize generate_command_mappings! end |
Instance Method Details
#go ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/controlio/client.rb', line 16 def go loop do check_for_commands.each do |c| klass, args = (c) if klass.present? puts "Running #{klass} (#{args})" instance = klass.new(args, @settings) spawn_and_timeout instance else send "Command '#{c['message']}' was not found!" end destroy c['_id'] end sleep POLL_DELAY end end |