Sha256: 11eb4946322f2062f31b13e8a63192aa9a7b2280de5d31d2e121b196001a0b1f
Contents?: true
Size: 369 Bytes
Versions: 2
Compression:
Stored size: 369 Bytes
Contents
module Id module Timestamps def self.included(base) base.field :created_at base.field :updated_at end def initialize(data = {}) super data.merge(_timestamps data) end private def _timestamps(data, now=Time.now) { created_at: data.fetch('created_at', now), updated_at: now } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
id-0.0.9 | lib/id/timestamps.rb |
id-0.0.8 | lib/id/timestamps.rb |