Module: EventMachine::Connectify
- Defined in:
- lib/em-connectify/connect.rb,
lib/em-connectify/connectify.rb
Defined Under Namespace
Modules: CONNECT
Instance Method Summary collapse
- #connect_hook ⇒ Object
- #connect_receive_data(data) ⇒ Object
- #connect_unhook ⇒ Object
- #connectify(host, port, username = nil, password = nil, &blk) ⇒ Object
Instance Method Details
#connect_hook ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/em-connectify/connectify.rb', line 20 def connect_hook extend CONNECT class << self alias receive_data connect_receive_data end end |
#connect_receive_data(data) ⇒ Object
36 37 38 39 |
# File 'lib/em-connectify/connectify.rb', line 36 def connect_receive_data(data) @connect_data << data connect_parse_response end |
#connect_unhook ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/em-connectify/connectify.rb', line 28 def connect_unhook class << self remove_method :receive_data end @connect_deferrable.succeed end |
#connectify(host, port, username = nil, password = nil, &blk) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/em-connectify/connectify.rb', line 5 def connectify(host, port, username=nil, password=nil, &blk) @connect_target_host = host @connect_target_port = port @connect_username = username @connect_password = password @connect_data = '' connect_hook connect_send_handshake @connect_deferrable = DefaultDeferrable.new @connect_deferrable.callback(&blk) if blk @connect_deferrable end |