Class: Rbuv::EM::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/rbuv/em/connection.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Connection

Returns a new instance of Connection.



17
18
# File 'lib/rbuv/em/connection.rb', line 17

def initialize(*args)
end

Class Method Details

.new(sig, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rbuv/em/connection.rb', line 5

def self.new(sig, *args)
  allocate.instance_eval do
    @signature = sig

    initialize(*args)

    post_init

    self
  end
end

Instance Method Details

#close_connection(after_writing = false) ⇒ Object



37
38
39
# File 'lib/rbuv/em/connection.rb', line 37

def close_connection(after_writing=false)
  EM.close_connection @signature, after_writing
end

#connection_completedObject



41
42
# File 'lib/rbuv/em/connection.rb', line 41

def connection_completed
end

#post_initObject



20
21
# File 'lib/rbuv/em/connection.rb', line 20

def post_init
end

#receive_data(data) ⇒ Object



23
24
25
# File 'lib/rbuv/em/connection.rb', line 23

def receive_data(data)
  puts "............>>>#{data.length}"
end

#send_data(data) ⇒ Object



30
31
32
33
34
35
# File 'lib/rbuv/em/connection.rb', line 30

def send_data(data)
  data = data.to_s
  size = data.bytesize if data.respond_to?(:bytesize)
  size ||= data.size
  EM.send_data @signature, data, size
end

#unbindObject



27
28
# File 'lib/rbuv/em/connection.rb', line 27

def unbind
end