Class: UV::Connection Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/uv-rays/connection.rb

Overview

This class is abstract.

Direct Known Subclasses

DatagramConnection, TcpConnection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



34
35
36
37
38
# File 'lib/uv-rays/connection.rb', line 34

def initialize
    @send_queue = []
    @paused = false
    @using_tls = false
end

Instance Attribute Details

#using_tlsObject (readonly)

Returns the value of attribute using_tls.



32
33
34
# File 'lib/uv-rays/connection.rb', line 32

def using_tls
  @using_tls
end

Instance Method Details

#close_connection(*args) ⇒ Object

Compatible with TCP



55
56
57
# File 'lib/uv-rays/connection.rb', line 55

def close_connection(*args)
    @transport.close
end

#on_read(data, *args) ⇒ Object

user to define



59
60
# File 'lib/uv-rays/connection.rb', line 59

def on_read(data, *args) # user to define
end

#pauseObject



40
41
42
43
# File 'lib/uv-rays/connection.rb', line 40

def pause
    @paused = true
    @transport.stop_read
end

#paused?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/uv-rays/connection.rb', line 45

def paused?
    @paused
end

#post_init(*args) ⇒ Object



62
63
# File 'lib/uv-rays/connection.rb', line 62

def post_init(*args)
end

#resumeObject



49
50
51
52
# File 'lib/uv-rays/connection.rb', line 49

def resume
    @paused = false
    @transport.start_read
end