Class: IRC::Server::Channels
- Inherits:
-
ThreadSafeHash
- Object
- Hash
- CaseInsensitiveHash
- ThreadSafeHash
- IRC::Server::Channels
- Defined in:
- lib/failirc/server/channels.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #__delete ⇒ Object
- #add(channel) ⇒ Object
- #delete(channel) ⇒ Object
-
#initialize(server, *args) ⇒ Channels
constructor
A new instance of Channels.
- #to_s(thing = nil) ⇒ Object
-
#unique_users ⇒ Object
get single users in the channels.
Methods inherited from ThreadSafeHash
Methods inherited from CaseInsensitiveHash
Constructor Details
#initialize(server, *args) ⇒ Channels
Returns a new instance of Channels.
31 32 33 34 35 |
# File 'lib/failirc/server/channels.rb', line 31 def initialize (server, *args) @server = server super(*args) end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
29 30 31 |
# File 'lib/failirc/server/channels.rb', line 29 def server @server end |
Instance Method Details
#__delete ⇒ Object
37 |
# File 'lib/failirc/server/channels.rb', line 37 alias __delete delete |
#add(channel) ⇒ Object
47 48 49 |
# File 'lib/failirc/server/channels.rb', line 47 def add (channel) self[channel.name] = channel end |
#delete(channel) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/failirc/server/channels.rb', line 39 def delete (channel) if channel.is_a?(Channel) __delete(channel.name) else __delete(channel) end end |
#to_s(thing = nil) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/failirc/server/channels.rb', line 64 def to_s (thing=nil) result = '' if thing.is_a?(Client) || thing.is_a?(User) each_value {|channel| result << " #{channel.user(thing).modes[:level]}#{channel.name}" } else each_value {|channel| result << " #{channel.name}" } end return result[1, result.length] end |