Module: Eye::Controller::Commands
- Included in:
- Eye::Controller
- Defined in:
- lib/eye/controller/commands.rb
Instance Method Summary collapse
-
#command(cmd, *args) ⇒ Object
Main method, answer for the client command.
Instance Method Details
#command(cmd, *args) ⇒ Object
Main method, answer for the client command
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/eye/controller/commands.rb', line 4 def command(cmd, *args) debug "client command: #{cmd} #{args * ', '}" start_at = Time.now cmd = cmd.to_sym res = case cmd when :start, :stop, :restart, :unmonitor, :monitor, :break_chain send_command(cmd, *args) when :delete exclusive{ send_command(cmd, *args) } when :signal signal(*args) when :load load(*args) when :quit quit when :check check(*args) when :explain explain(*args) when :match match(*args) when :ping :pong when :logger_dev Eye::Logger.dev # object commands, for api when :info_data info_data(*args) when :short_data short_data(*args) when :debug_data debug_data(*args) when :history_data history_data(*args) else :unknown_command end GC.start info "client command: #{cmd} #{args * ', '} (#{Time.now - start_at}s)" res end |