Module: Identifiable

Included in:
Selector
Defined in:
tomes/spells/identifiable.rb

Overview

This module imparts a class-level ID counter (as well as methods for manipulating said counter) and a class tag.

Instance Method Summary collapse

Instance Method Details

#id_counterInteger

Returns the class ID counter.

Returns:

  • (Integer)


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

def id_counter
  @id_counter
end

#increment_id_counterVoid

Adds 1 to the ID counter.

Returns:

  • (Void)


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

def increment_id_counter
  @id_counter += 1
end

#tagString

Returns the class tag.

Returns:

  • (String)


30
31
32
# File 'tomes/spells/identifiable.rb', line 30

def tag
  @tag
end

#tag=(tag) ⇒ Void

Assigns the class (and its descendants) a tag for the #id_tag method in Identity.

Parameters:

  • tag (String)

Returns:

  • (Void)


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

def tag=(tag)
  @tag = tag
end