Class: Client::ChannelInitializer
Overview
The ChannelInitializer class
Instance Attribute Summary collapse
-
#decoder ⇒ Object
Returns the value of attribute decoder.
-
#encoder ⇒ Object
Returns the value of attribute encoder.
-
#handlers ⇒ Object
Returns the value of attribute handlers.
Instance Method Summary collapse
- #<<(handler) ⇒ Object
- #default_handler ⇒ Object
- #frame_decoder ⇒ Object
- #initChannel(channel) ⇒ Object
-
#initialize(options = {}) ⇒ ChannelInitializer
constructor
A new instance of ChannelInitializer.
Constructor Details
#initialize(options = {}) ⇒ ChannelInitializer
Returns a new instance of ChannelInitializer.
358 359 360 361 362 363 364 365 366 |
# File 'lib/client.rb', line 358 def initialize( = {}) super() = @host = [:host] @port = [:port] @handlers = [] @decoder = StringDecoder.new @encoder = StringEncoder.new end |
Instance Attribute Details
#decoder ⇒ Object
Returns the value of attribute decoder.
356 357 358 |
# File 'lib/client.rb', line 356 def decoder @decoder end |
#encoder ⇒ Object
Returns the value of attribute encoder.
356 357 358 |
# File 'lib/client.rb', line 356 def encoder @encoder end |
#handlers ⇒ Object
Returns the value of attribute handlers.
356 357 358 |
# File 'lib/client.rb', line 356 def handlers @handlers end |
Instance Method Details
#<<(handler) ⇒ Object
368 369 370 |
# File 'lib/client.rb', line 368 def <<(handler) @handlers << handler end |
#default_handler ⇒ Object
386 387 388 |
# File 'lib/client.rb', line 386 def default_handler @default_handler ||= ::Client::ModularHandler.new end |
#frame_decoder ⇒ Object
382 383 384 |
# File 'lib/client.rb', line 382 def frame_decoder DelimiterBasedFrameDecoder.new([:max_frame_length], [:delimiter]) end |
#initChannel(channel) ⇒ Object
372 373 374 375 376 377 378 379 380 |
# File 'lib/client.rb', line 372 def initChannel(channel) pipeline = channel.pipeline pipeline.addLast(ssl_handler(channel)) if [:ssl] # pipeline.addLast(frame_decoder) pipeline.addLast(decoder) pipeline.addLast(encoder) add_user_handlers(pipeline) pipeline.addLast(default_handler) end |