Class: EventMachine::IRC::Dispatcher
- Inherits:
-
Connection
- Object
- Connection
- EventMachine::IRC::Dispatcher
- Extended by:
- Forwardable
- Defined in:
- lib/em-irc/dispatcher.rb
Overview
EventMachine connection handler class that dispatches connections back to another object.
Instance Method Summary collapse
- #connection_completed ⇒ Object
-
#initialize(options) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
- #post_init ⇒ Object
- #ssl_handshake_completed ⇒ Object
Constructor Details
#initialize(options) ⇒ Dispatcher
Returns a new instance of Dispatcher.
8 9 10 11 12 |
# File 'lib/em-irc/dispatcher.rb', line 8 def initialize() raise ArgumentError.new(":parent parameter is required for EM#connect") unless [:parent] # TODO: if parent doesn't respond to a above methods, do a no-op @parent = [:parent] end |
Instance Method Details
#connection_completed ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/em-irc/dispatcher.rb', line 20 def connection_completed if @parent.ssl start_tls else @parent.ready end end |
#post_init ⇒ Object
15 16 17 18 |
# File 'lib/em-irc/dispatcher.rb', line 15 def post_init @parent.conn = self @parent.ready unless @parent.ssl end |
#ssl_handshake_completed ⇒ Object
28 29 30 |
# File 'lib/em-irc/dispatcher.rb', line 28 def ssl_handshake_completed @parent.ready if @parent.ssl end |