class FFWD::TCP::SetupOutput

Attributes

config[R]

Public Class Methods

new(config, log, handler) click to toggle source
# File lib/ffwd/protocol/tcp.rb, line 31
def initialize config, log, handler
  @config = Hash[config]
  @log = log
  @handler = handler

  @config = Connection.prepare @config

  if @config[:flush_period] == 0
    @config = PlainConnect.prepare @config
    @type = PlainConnect
  else
    @config = FlushingConnect.prepare @config
    @type = FlushingConnect
  end
end

Public Instance Methods

connect(core) click to toggle source
# File lib/ffwd/protocol/tcp.rb, line 47
def connect core
  raise "Missing required option :host" if (host = @config[:host]).nil?
  raise "Missing required option :port" if (port = @config[:port]).nil?

  c = Connection.new @log, host, port, @handler, @config
  @type.new core, @log, c, @config
end