Class: Wee::SimpleIdGenerator

Inherits:
IdGenerator show all
Defined in:
lib/wee/idgen/simple.rb

Overview

Returned ids are guaranteed to be unique, but they are easily guessable.

Instance Method Summary collapse

Constructor Details

#initialize(initial_value = 0) ⇒ SimpleIdGenerator

Returns a new instance of SimpleIdGenerator.



4
5
6
# File 'lib/wee/idgen/simple.rb', line 4

def initialize(initial_value=0)
  @value = initial_value
end

Instance Method Details

#nextObject



8
9
10
# File 'lib/wee/idgen/simple.rb', line 8

def next
  @value += 1
end