Class: IRCChannel
- Inherits:
-
Object
- Object
- IRCChannel
- Defined in:
- lib/IRCChannel.rb
Overview
Represents an IRC Channel
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#add_user(username) ⇒ Object
add a user to this channel’s userlist.
-
#initialize(name) ⇒ IRCChannel
constructor
A new instance of IRCChannel.
-
#topic ⇒ Object
get the topic on this channel.
-
#topic=(topic) ⇒ Object
set the topic on this channel.
-
#users ⇒ Object
returns the current user list for this channel.
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
#name ⇒ Object (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 |
#topic ⇒ Object
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 |
#users ⇒ Object
returns the current user list for this channel
30 31 32 |
# File 'lib/IRCChannel.rb', line 30 def users @users end |