class Mementus::IntegerId
Public Class Methods
new(start_value=1)
click to toggle source
# File lib/mementus/integer_id.rb, line 5 def initialize(start_value=1) @current_value = start_value @mutex = Mutex.new end
Public Instance Methods
next_id()
click to toggle source
# File lib/mementus/integer_id.rb, line 10 def next_id @mutex.lock allocated = @current_value @current_value += 1 @mutex.unlock allocated end