Class: Lotus::Model::Adapters::Memory::Collection::PrimaryKey Private
- Inherits:
-
Object
- Object
- Lotus::Model::Adapters::Memory::Collection::PrimaryKey
- Defined in:
- lib/lotus/model/adapters/memory/collection.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A counter that simulates autoincrement primary key of a SQL table.
Instance Method Summary collapse
-
#increment! {|@current += 1| ... } ⇒ Fixnum
private
Increment the current count by 1 and yields the given block.
-
#initialize ⇒ Lotus::Model::Adapters::Memory::Collection::PrimaryKey
constructor
private
Initialize.
Constructor Details
#initialize ⇒ Lotus::Model::Adapters::Memory::Collection::PrimaryKey
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize
21 22 23 |
# File 'lib/lotus/model/adapters/memory/collection.rb', line 21 def initialize @current = 0 end |
Instance Method Details
#increment! {|@current += 1| ... } ⇒ Fixnum
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Increment the current count by 1 and yields the given block
31 32 33 34 |
# File 'lib/lotus/model/adapters/memory/collection.rb', line 31 def increment! yield(@current += 1) @current end |