Sha256: bab38e272b11596e5947509821b5ae76bf9c7623ddf2b98ad39533222f493cfc
Contents?: true
Size: 446 Bytes
Versions: 1
Compression:
Stored size: 446 Bytes
Contents
require 'securerandom' module UniqIdentifier module Hook def uuid(*args, &block) generate_uniq_identifier! if super(*args, &block).nil? super end def set_uniq_identifier generate_uniq_identifier! if self.uuid.nil? end def generate_uniq_identifier! if self.class.uniq_identifier_generator.respond_to?(:uuid) self.uuid = self.class.uniq_identifier_generator.uuid end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uniq_identifier-0.1.1 | lib/uniq_identifier/hook.rb |