Class: IRC::Client::Channel

Inherits:
Object show all
Defined in:
lib/failirc/client/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.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/failirc/client/channel.rb', line 51

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

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

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def client
  @client
end

#createdOnObject

Returns the value of attribute createdOn.



49
50
51
# File 'lib/failirc/client/channel.rb', line 49

def createdOn
  @createdOn
end

#modesObject (readonly)

Returns the value of attribute modes.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def modes
  @modes
end

#nameObject (readonly)

Returns the value of attribute name.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def name
  @name
end

#serverObject (readonly)

Returns the value of attribute server.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def server
  @server
end

#topicObject (readonly)

Returns the value of attribute topic.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def topic
  @topic
end

#typeObject (readonly)

Returns the value of attribute type.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def type
  @type
end

#usersObject (readonly)

Returns the value of attribute users.



48
49
50
# File 'lib/failirc/client/channel.rb', line 48

def users
  @users
end

Instance Method Details

#[](user) ⇒ Object



67
68
69
# File 'lib/failirc/client/channel.rb', line 67

def [] (user)
    users[user]
end

#add(user) ⇒ Object



71
72
73
# File 'lib/failirc/client/channel.rb', line 71

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

#delete(user) ⇒ Object



75
76
77
# File 'lib/failirc/client/channel.rb', line 75

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

#empty?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/failirc/client/channel.rb', line 83

def empty?
    return @users.empty?
end

#send(*args) ⇒ Object



87
88
89
# File 'lib/failirc/client/channel.rb', line 87

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

#to_sObject



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

def to_s
    @name
end

#user(client) ⇒ Object



79
80
81
# File 'lib/failirc/client/channel.rb', line 79

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