Class: AutoIncrement::Incrementor
- Inherits:
-
Object
- Object
- AutoIncrement::Incrementor
- Defined in:
- lib/auto_increment/incrementor.rb
Overview
AutoIncrement::Incrementor
Instance Method Summary collapse
-
#initialize(record, column = nil, **options) ⇒ Incrementor
constructor
A new instance of Incrementor.
- #run ⇒ Object
Constructor Details
#initialize(record, column = nil, **options) ⇒ Incrementor
Returns a new instance of Incrementor.
7 8 9 10 11 12 13 14 15 |
# File 'lib/auto_increment/incrementor.rb', line 7 def initialize(record, column = nil, **) @record = record @column = column || .fetch(:column, :code) @initial = resolve_initial() @force = .fetch(:force, false) @scope = Array.wrap([:scope]).compact @model_scope = Array.wrap([:model_scope]).compact @lock = .fetch(:lock, false) end |
Instance Method Details
#run ⇒ Object
17 18 19 |
# File 'lib/auto_increment/incrementor.rb', line 17 def run write if can_write? end |