Class: MR::Factory::PrimaryKeyProvider
- Inherits:
-
Object
- Object
- MR::Factory::PrimaryKeyProvider
- Defined in:
- lib/mr/factory.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
Instance Method Summary collapse
-
#initialize ⇒ PrimaryKeyProvider
constructor
A new instance of PrimaryKeyProvider.
- #next ⇒ Object
Constructor Details
#initialize ⇒ PrimaryKeyProvider
Returns a new instance of PrimaryKeyProvider.
47 48 49 50 |
# File 'lib/mr/factory.rb', line 47 def initialize @current = 0 @mutex = Mutex.new end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
46 47 48 |
# File 'lib/mr/factory.rb', line 46 def current @current end |
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
46 47 48 |
# File 'lib/mr/factory.rb', line 46 def mutex @mutex end |
Instance Method Details
#next ⇒ Object
51 52 53 |
# File 'lib/mr/factory.rb', line 51 def next @mutex.synchronize{ @current += 1 } end |