Class: Person::PersonIDGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/entity/person/person.rb

Overview

singleton class to serve as an id generator for Person and their children.

Constant Summary collapse

@@id =

Returns the current id.

Returns:

  • (Fixnum)

    the current id

0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ PersonIDGenerator

initialization

Parameters:

  • id (Fixnum)

    the start id



65
66
67
# File 'lib/entity/person/person.rb', line 65

def initialize(id)
  @@id = id
end

Class Method Details

.generate_new_idFixnum

generates a new id and returns it

Returns:

  • (Fixnum)

    new id



71
72
73
# File 'lib/entity/person/person.rb', line 71

def self.generate_new_id
  @@id += 1
end