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.



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

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

Instance Attribute Details

#using_tlsObject (readonly)

Returns the value of attribute using_tls.



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

def using_tls
  @using_tls
end

Instance Method Details

#close_connection(*args) ⇒ Object

Compatible with TCP



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

def close_connection(*args)
    @transport.close
end

#on_read(data, *args) ⇒ Object

user to define



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

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

#pauseObject



42
43
44
45
# File 'lib/uv-rays/connection.rb', line 42

def pause
    @paused = true
    @transport.stop_read
end

#paused?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/uv-rays/connection.rb', line 47

def paused?
    @paused
end

#post_init(*args) ⇒ Object



64
65
# File 'lib/uv-rays/connection.rb', line 64

def post_init(*args)
end

#resumeObject



51
52
53
54
# File 'lib/uv-rays/connection.rb', line 51

def resume
    @paused = false
    @transport.start_read
end