Class: IRC::Server::Channel

Inherits:
Object show all
Defined in:
lib/failirc/server/channel.rb

Defined Under Namespace

Classes: Topic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server, name) ⇒ Channel

Returns a new instance of Channel.



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/failirc/server/channel.rb', line 63

def initialize (server, name)
    @server = server
    @name   = name
    @type   = name[0, 1]

    @createdOn = Time.now
    @users     = Users.new(self)
    @modes     = Modes.new
    @topic     = Topic.new(self)

    @semaphore = Mutex.new
end

Instance Attribute Details

#createdOnObject (readonly)

Returns the value of attribute createdOn.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def createdOn
  @createdOn
end

#modesObject (readonly)

Returns the value of attribute modes.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def modes
  @modes
end

#nameObject (readonly)

Returns the value of attribute name.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def name
  @name
end

#serverObject (readonly)

Returns the value of attribute server.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def server
  @server
end

#topicObject

Returns the value of attribute topic.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def topic
  @topic
end

#typeObject (readonly)

Returns the value of attribute type.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def type
  @type
end

#usersObject (readonly)

Returns the value of attribute users.



61
62
63
# File 'lib/failirc/server/channel.rb', line 61

def users
  @users
end

Instance Method Details

#[](user) ⇒ Object



91
92
93
# File 'lib/failirc/server/channel.rb', line 91

def [] (user)
    users[user]
end

#add(user) ⇒ Object



95
96
97
# File 'lib/failirc/server/channel.rb', line 95

def add (user)
    users.add(user)
end

#delete(user) ⇒ Object



99
100
101
# File 'lib/failirc/server/channel.rb', line 99

def delete (user)
    users.delete(user)
end

#empty?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/failirc/server/channel.rb', line 107

def empty?
    return @users.empty?
end

#send(*args) ⇒ Object



111
112
113
# File 'lib/failirc/server/channel.rb', line 111

def send (*args)
    users.send(*args)
end

#to_sObject



115
116
117
# File 'lib/failirc/server/channel.rb', line 115

def to_s
    @name
end

#user(client) ⇒ Object



103
104
105
# File 'lib/failirc/server/channel.rb', line 103

def user (client)
    return @users[client.nick]
end