Class: Server::Server

Inherits:
Object show all
Includes:
InstanceMethods
Defined in:
lib/server/server.rb

Overview

The Server class sets up the netty server.

Constant Summary collapse

CHANNEL_TYPE =
Java::io.netty.channel.socket.nio.NioServerSocketChannel.java_class

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from InstanceMethods

#<<, #add_listener, #bootstrap, #boss_group, #channel_group, #channel_initializer, #channel_type, #configure_handlers, #keep_alive, #logging_handler, #max_queued_incoming_connections, #port, #replace_listeners, #run, #shutdown, #stop, #worker_group

Methods included from DefaultHandler

#channel_active, #exception_caught, #message_received

Constructor Details

#initialize(options = {}, *handlers, &block) ⇒ Server

Returns a new instance of Server.



27
28
29
30
31
32
33
34
# File 'lib/server/server.rb', line 27

def initialize(options = {}, *handlers, &block)
  raise ArgumentError, 'Parameter may not be nil: options' if options.nil?
  @options = ::Server.server_config.merge(options)
  configure_handlers(*(handlers.empty? && block.nil? ? [self] : handlers), &block)
ensure
  listeners = channel_initializer.default_handler.listeners
  log.trace "##{__method__} listeners: #{listeners}"
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



25
26
27
# File 'lib/server/server.rb', line 25

def options
  @options
end