Class: Person::PersonIDGenerator
- Inherits:
-
Object
- Object
- Person::PersonIDGenerator
- 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.
0
Class Method Summary collapse
-
.generate_new_id ⇒ Fixnum
generates a new id and returns it.
Instance Method Summary collapse
-
#initialize(id) ⇒ PersonIDGenerator
constructor
initialization.
Constructor Details
#initialize(id) ⇒ PersonIDGenerator
initialization
65 66 67 |
# File 'lib/entity/person/person.rb', line 65 def initialize(id) @@id = id end |
Class Method Details
.generate_new_id ⇒ Fixnum
generates a new id and returns it
71 72 73 |
# File 'lib/entity/person/person.rb', line 71 def self.generate_new_id @@id += 1 end |