Module: Sequel::Plugins::Timestamps::ClassMethods

Defined in:
lib/sequel/lib/sequel/plugins/timestamps.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#create_timestamp_fieldObject (readonly)

The field to store the create timestamp


27
28
29
# File 'lib/sequel/lib/sequel/plugins/timestamps.rb', line 27

def create_timestamp_field
  @create_timestamp_field
end

#update_timestamp_fieldObject (readonly)

The field to store the update timestamp


30
31
32
# File 'lib/sequel/lib/sequel/plugins/timestamps.rb', line 30

def update_timestamp_field
  @update_timestamp_field
end

Instance Method Details

#create_timestamp_overwrite?Boolean

Whether to overwrite the create timestamp if it already exists


33
34
35
# File 'lib/sequel/lib/sequel/plugins/timestamps.rb', line 33

def create_timestamp_overwrite?
  @create_timestamp_overwrite
end

#inherited(subclass) ⇒ Object

Copy the class instance variables used from the superclass to the subclass


38
39
40
41
42
43
# File 'lib/sequel/lib/sequel/plugins/timestamps.rb', line 38

def inherited(subclass)
  super
  [:@create_timestamp_field, :@update_timestamp_field, :@create_timestamp_overwrite, :@set_update_timestamp_on_create].each do |iv|
    subclass.instance_variable_set(iv, instance_variable_get(iv))
  end
end

#set_update_timestamp_on_create?Boolean

Whether to set the update timestamp to the create timestamp when creating


46
47
48
# File 'lib/sequel/lib/sequel/plugins/timestamps.rb', line 46

def set_update_timestamp_on_create?
  @set_update_timestamp_on_create
end