Class | ArrayOf
In: | lib/rbot/irc.rb
Parent: | Array

ArrayOf is a subclass of Array whose elements are supposed to be all of the same class. This is not intended to be used directly, but rather to be subclassed as needed (see for example Irc::UserList and Irc::NetmaskList)

Presently, only very few selected methods from Array are overloaded to check if the new elements are the correct class. An orthodox? method is provided to check the entire ArrayOf against the appropriate class.

### Methods

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

### Attributes

element_class | [R] |

### Public Class methods

new(kl, ar=[])

Create a new ArrayOf whose elements are supposed to be all of type kl, optionally filling it with the elements from the Array argument.

### Public Instance methods

&(ar)

Overloaded from Array#&, checks for appropriate class of argument elements

+(ar)

Overloaded from Array#+, checks for appropriate class of argument elements

-(ar)

Overloaded from Array#-, so that an ArrayOf is returned. There is no need to check the validity of the elements in the argument

<<(el)

Overloaded from Array#<<, checks for appropriate class of argument

concat(ar)

Overloaded from Array#concat, checks for appropriate class of argument elements

downcase()

We introduce the ‘downcase’ method, which maps downcase() to all the Array elements, properly failing when the elements don‘t have a downcase method

insert(idx, *ar)

Overloaded from Array#insert, checks for appropriate class of argument elements

inspect()
push(*ar)

Overloaded from Array#push, checks for appropriate class of argument elements

replace(ar)

Overloaded from Array#replace, checks for appropriate class of argument elements

unshift(*els)

Overloaded from Array#unshift, checks for appropriate class of argument(s)

valid?()

This method checks that all elements are of the appropriate class

validate()

This method is similar to the above, except that it raises an exception if the receiver is not valid

will_accept?(*els)

This method checks if the passed arguments are acceptable for our ArrayOf

|(ar)

Overloaded from Array#|, checks for appropriate class of argument elements

[Validate]