Class: Irc::Channel::UserMode

Inherits:
ModeTypeB show all
Defined in:
lib/rbot/irc.rb

Overview

Channel modes that change the User prefixes are like Channel modes of type B, except that they manipulate lists of Users, so they are somewhat similar to channel modes of type A

Instance Attribute Summary collapse

Attributes inherited from Mode

#channel

Instance Method Summary collapse

Methods inherited from ModeTypeB

#status

Constructor Details

#initialize(ch) ⇒ UserMode

Returns a new instance of UserMode.



1206
1207
1208
1209
# File 'lib/rbot/irc.rb', line 1206

def initialize(ch)
  super
  @list = UserList.new
end

Instance Attribute Details

#listObject (readonly) Also known as: users

Returns the value of attribute list.



1204
1205
1206
# File 'lib/rbot/irc.rb', line 1204

def list
  @list
end

Instance Method Details

#reset(val) ⇒ Object



1216
1217
1218
1219
# File 'lib/rbot/irc.rb', line 1216

def reset(val)
  u = @channel.server.user(val)
  @list.delete(u)
end

#set(val) ⇒ Object



1211
1212
1213
1214
# File 'lib/rbot/irc.rb', line 1211

def set(val)
  u = @channel.server.user(val)
  @list << u unless @list.include?(u)
end