Class: Irc::UserList

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

Overview

A UserList is an ArrayOf Users We derive it from NetmaskList, which allows us to inherit any special NetmaskList method

Instance Attribute Summary

Attributes inherited from ArrayOf

#element_class

Instance Method Summary collapse

Methods inherited from NetmaskList

#[]

Methods inherited from ArrayOf

#&, #+, #-, #<<, #concat, #downcase, #insert, #inspect, #push, #replace, #unshift, #valid?, #validate, #will_accept?, #|

Methods inherited from Array

#delete_one, #pick_one, #shuffle, #shuffle!

Constructor Details

#initialize(ar = []) ⇒ UserList

Create a new UserList, optionally filling it with the elements from the Array argument fed to it.



1087
1088
1089
1090
# File 'lib/rbot/irc.rb', line 1087

def initialize(ar=[])
  super(ar)
  @element_class = User
end

Instance Method Details

#nicksObject

Convenience method: convert the UserList to a list of nicks. The indices are preserved



1095
1096
1097
# File 'lib/rbot/irc.rb', line 1095

def nicks
  self.map { |user| user.nick }
end