Class: Arbi::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/arbi/server.rb

Defined Under Namespace

Modules: Server

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address = '127.0.0.1', port = 6969) ⇒ Server

Returns a new instance of Server.



49
50
51
52
# File 'lib/arbi/server.rb', line 49

def initialize(address = '127.0.0.1', port = 6969)
  @address  = address || '127.0.0.1'
  @port     = port    ||  6969
end

Class Method Details

.start(address = '127.0.0.1', port = 6969) ⇒ Object



63
64
65
66
67
# File 'lib/arbi/server.rb', line 63

def self.start(address = '127.0.0.1', port = 6969)
  self.new(address, port).tap {|s|
    s.start
  }
end

Instance Method Details

#startObject



54
55
56
57
58
59
60
61
# File 'lib/arbi/server.rb', line 54

def start
  EventMachine.epoll = true if EventMachine.epoll?
  EventMachine.kqueue = true if EventMachine.kqueue?
  TimeLine.run
  EventMachine.start_server(@address, @port, Arbi::Server::Server)
  Arbi.debug("Starting server on #{@address}:#{@port}")
  nil
end