Class: IRCChannel

Inherits:
Object
  • Object
show all
Defined in:
lib/IRCChannel.rb

Overview

Represents an IRC Channel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ IRCChannel

Returns a new instance of IRCChannel.



5
6
7
8
# File 'lib/IRCChannel.rb', line 5

def initialize(name)
  @name = name
  @users = Array.new(0)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/IRCChannel.rb', line 9

def name
  @name
end

Instance Method Details

#add_user(username) ⇒ Object

add a user to this channel’s userlist



25
26
27
# File 'lib/IRCChannel.rb', line 25

def add_user(username)
  @users.push(IRCUser.create_user(username))
end

#topicObject

get the topic on this channel



17
18
19
20
21
22
# File 'lib/IRCChannel.rb', line 17

def topic 
  if @topic
    return @topic
  end
  return "No Topic set"
end

#topic=(topic) ⇒ Object

set the topic on this channel



12
13
14
# File 'lib/IRCChannel.rb', line 12

def topic=(topic)
  @topic = topic
end

#usersObject

returns the current user list for this channel



30
31
32
# File 'lib/IRCChannel.rb', line 30

def users
  @users
end