Class: Task::TaskIDGenerator

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

Overview

singleton class to serve as an id generator for Task.

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) ⇒ TaskIDGenerator

initialization

Parameters:

  • id (Fixnum)

    the start id



87
88
89
# File 'lib/entity/task.rb', line 87

def initialize(id)
  @@id = id
end

Class Method Details

.generate_new_idFixnum

generates a new id and returns it

Returns:

  • (Fixnum)

    new id



93
94
95
# File 'lib/entity/task.rb', line 93

def self.generate_new_id
  @@id += 1
end