Class: Librr::CmdServer

Inherits:
Object
  • Object
show all
Defined in:
lib/librr/cmd_server.rb

Defined Under Namespace

Classes: CmdServerHandler

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexerObject

Returns the value of attribute indexer.



9
10
11
# File 'lib/librr/cmd_server.rb', line 9

def indexer
  @indexer
end

#monitorObject

Returns the value of attribute monitor.



9
10
11
# File 'lib/librr/cmd_server.rb', line 9

def monitor
  @monitor
end

Instance Method Details

#init(opts) ⇒ Object



11
12
13
14
15
# File 'lib/librr/cmd_server.rb', line 11

def init opts
  self.monitor = opts[:monitor]
  self.indexer = opts[:indexer]
  CmdServerHandler.set_server(self)
end

#start(&block) ⇒ Object



17
18
19
20
# File 'lib/librr/cmd_server.rb', line 17

def start(&block)
  EventMachine.start_server "localhost", Settings.runner_port, CmdServerHandler
  EM.add_timer(1){ block.call if block }
end