Class: FFWD::TCP::SetupOutput
- Inherits:
-
Object
- Object
- FFWD::TCP::SetupOutput
- Defined in:
- lib/ffwd/protocol/tcp.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #connect(core) ⇒ Object
-
#initialize(config, log, handler) ⇒ SetupOutput
constructor
A new instance of SetupOutput.
Constructor Details
#initialize(config, log, handler) ⇒ SetupOutput
Returns a new instance of SetupOutput.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
29 30 31 |
# File 'lib/ffwd/protocol/tcp.rb', line 29 def config @config end |
Instance Method Details
#connect(core) ⇒ Object
47 48 49 50 51 52 53 |
# 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 |