Class: IRC::Client::Dispatcher::ConnectionDispatcher::Connections
- Defined in:
- lib/failirc/client/dispatcher/connectiondispatcher.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #delete(socket) ⇒ Object
- #empty? ⇒ Boolean
- #exists?(socket) ⇒ Boolean
-
#initialize(client) ⇒ Connections
constructor
A new instance of Connections.
- #servers ⇒ Object
- #sockets ⇒ Object
Constructor Details
#initialize(client) ⇒ Connections
Returns a new instance of Connections.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 39 def initialize (client) @client = client @data = ThreadSafeHash.new @data[:sockets] = [] @data[:servers] = { :bySocket => {}, :byName => {}, } end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
37 38 39 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 37 def client @client end |
Instance Method Details
#delete(socket) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 66 def delete (socket) if !exists?(socket) return end @data[:sockets].delete(socket) server = @data[:servers][:bySocket][socket] @data[:servers][:bySocket].delete(socket) @data[:servers][:byName].delete(server.name) end |
#empty? ⇒ Boolean
58 59 60 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 58 def empty? sockets.empty? end |
#exists?(socket) ⇒ Boolean
62 63 64 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 62 def exists? (socket) servers[:bySocket][socket] ? true : false end |
#servers ⇒ Object
54 55 56 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 54 def servers @data[:servers] end |
#sockets ⇒ Object
50 51 52 |
# File 'lib/failirc/client/dispatcher/connectiondispatcher.rb', line 50 def sockets @data[:sockets] end |