Class: Krtek::Irc::Handler

Inherits:
EM::Connection
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/krtek/handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Handler

Returns a new instance of Handler.

Raises:

  • (ArgumentError)


9
10
11
12
13
# File 'lib/krtek/handler.rb', line 9

def initialize(opts = {})
  raise ArgumentError, "missing :client parameter for EM#connect" unless opts[:client]
  @client = opts[:client]
  @ssl    = opts[:ssl] || false
end

Instance Method Details

#connection_completedObject



23
24
25
# File 'lib/krtek/handler.rb', line 23

def connection_completed
  @ssl ? start_tls : @client.ready
end

#post_initObject



19
20
21
# File 'lib/krtek/handler.rb', line 19

def post_init
  @client.connection = self
end

#send_data(data) ⇒ Object



15
16
17
# File 'lib/krtek/handler.rb', line 15

def send_data(data)
  super
end

#ssl_handshake_completedObject



27
28
29
# File 'lib/krtek/handler.rb', line 27

def ssl_handshake_completed
  @client.ready if @client.ssl
end