Sha256: 21b70339835f8ced4edbaacae4e219a07895117b55a43985fb40ffbfb5f9212a
Contents?: true
Size: 345 Bytes
Versions: 2
Compression:
Stored size: 345 Bytes
Contents
module Id::Timestamps def self.included(base) base.field :created_at base.field :updated_at end def initialize(_data = {}) now = Time.now super ({ created_at: now, updated_at: now }).merge(_data) end def set(update) super update.merge(updated_at: Time.now) end def unset(update) super.set({}) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
id-0.1.1 | lib/id/timestamps.rb |
id-0.1 | lib/id/timestamps.rb |