Sha256: 3622b57d4efccba8ede714c083f1d14334a25bda1438da8ef7200af7dd578c87
Contents?: true
Size: 603 Bytes
Versions: 2
Compression:
Stored size: 603 Bytes
Contents
require 'singleton' module ROM module Factory # @api private class Sequences include Singleton # @api private attr_reader :registry # @api private def self.[](relation) key = :"#{relation.gateway}-#{relation.name.dataset}" -> { instance.next(key) } end # @api private def initialize reset end # @api private def next(key) registry[key] += 1 end # @api private def reset @registry = Concurrent::Map.new { |h, k| h[k] = 0 } self end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rom-factory-0.7.0 | lib/rom/factory/sequences.rb |
rom-factory-0.6.0 | lib/rom/factory/sequences.rb |