Module: Group

Defined in:
tomes/spells/group.rb

Overview

A module for giving a Class the ability to log and track instances of itself.

Instance Method Summary collapse

Instance Method Details

#add(object) ⇒ Void

Adds an object to the list. This method should probably be called in #initialize.

Parameters:

  • object (Object)

    An instance of the class.

Returns:

  • (Void)


11
12
13
# File 'tomes/spells/group.rb', line 11

def add(object)
  @list << object
end

#delete(object) ⇒ Void

Removes an object from the list.

Parameters:

  • object (Object)

    An instance of the class.

Returns:

  • (Void)


18
19
20
# File 'tomes/spells/group.rb', line 18

def delete(object)
  @list.delete(object)
end

#listArray Also known as: all

An array of all the instances of a class being tracked.

Returns:

  • (Array)


24
25
26
# File 'tomes/spells/group.rb', line 24

def list
  @list
end