Class: BullServerController
- Inherits:
-
Object
- Object
- BullServerController
- Defined in:
- lib/bull/server.rb
Overview
module Bull
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(ws, conn) ⇒ BullServerController
constructor
A new instance of BullServerController.
- #notify(msg) ⇒ Object
Methods included from MReport
load_reports, #reports, reports
Methods included from Logging
#logger, logger, #stdout_logger, stdout_logger
Constructor Details
#initialize(ws, conn) ⇒ BullServerController
Returns a new instance of BullServerController.
65 66 67 68 69 70 71 72 |
# File 'lib/bull/server.rb', line 65 def initialize(ws, conn) @ws = ws @conn = conn @watch = {} @user_id = nil @user_doc = nil @root = Fiber.current end |
Instance Method Details
#close ⇒ Object
95 96 97 |
# File 'lib/bull/server.rb', line 95 def close @watch.each_value {|w| w.close} end |
#notify(msg) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/bull/server.rb', line 74 def notify(msg) msg = JSON.parse msg #logger.info msg stdout_logger.info msg command = msg['command'] kwargs = symbolize_keys(msg['kwargs']) resolve_times kwargs, msg['times'] if command.start_with? 'rpc_' handle_rpc command, msg['id'], *msg['args'], **kwargs elsif command.start_with? 'task_' handle_task command, *msg['args'], **kwargs elsif command.start_with? 'file_' handle_file command, *msg['args'], **kwargs elsif command.start_with? 'watch_' handle_watch command, msg['id'], *msg['args'], **kwargs elsif command == 'stop_watch' handle_stop_watch msg['id'] end end |