Sha256: d570e1a33f5c652abc8518f071aed50b527b41bdf6f324aca98077d484b5c93e
Contents?: true
Size: 433 Bytes
Versions: 9
Compression:
Stored size: 433 Bytes
Contents
module AngularSprinkles class KeyGenerator def initialize(args) @counter = args.fetch(:counter) @cache = args.fetch(:cache) end def call(object) return @cache.get(object) if @cache.set?(object) klass = "#{object.class}".gsub("::", "__") count = @counter.inc(klass) generated_key = "#{klass}_#{count}" @cache.set(object, generated_key) generated_key end end end
Version data entries
9 entries across 9 versions & 1 rubygems