Class: MongoidAutoIncrement::Incrementor
- Inherits:
-
Object
- Object
- MongoidAutoIncrement::Incrementor
- Defined in:
- lib/mongoid_auto_increment/incrementor.rb
Defined Under Namespace
Classes: Sequence
Instance Method Summary collapse
- #inc(sequence, options, record) ⇒ Object
-
#initialize(options = nil) ⇒ Incrementor
constructor
A new instance of Incrementor.
Constructor Details
#initialize(options = nil) ⇒ Incrementor
Returns a new instance of Incrementor.
66 |
# File 'lib/mongoid_auto_increment/incrementor.rb', line 66 def initialize( = nil); end |
Instance Method Details
#inc(sequence, options, record) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/mongoid_auto_increment/incrementor.rb', line 68 def inc(sequence, , record) collection = [:collection] || 'sequences' seed = [:seed].to_i step = [:step] || 1 scope = resolve_scope(record, [:scope]) Sequence.new(sequence, collection, seed, step, scope).inc end |