module ROM::Plugins::Command::Timestamps::InstanceMethods

Public Instance Methods

datestamp_columns() click to toggle source

@api private

# File lib/rom/plugins/command/timestamps.rb, line 61
def datestamp_columns
  self.class.datestamp_columns
end
set_timestamps(tuples, *) click to toggle source

Set the timestamp attributes on the given tuples

@param [Array<Hash>, Hash] tuples the input tuple(s)

@return [Array<Hash>, Hash]

@api private

# File lib/rom/plugins/command/timestamps.rb, line 72
def set_timestamps(tuples, *)
  timestamps = build_timestamps

  map_input_tuples(tuples) { |t| timestamps.merge(t) }
end
timestamp_columns() click to toggle source

@api private

# File lib/rom/plugins/command/timestamps.rb, line 56
def timestamp_columns
  self.class.timestamp_columns
end

Private Instance Methods

build_timestamps() click to toggle source

@api private

# File lib/rom/plugins/command/timestamps.rb, line 81
def build_timestamps
  time        = Time.now.utc
  date        = Date.today
  timestamps  = {}

  timestamp_columns.each do |column|
    timestamps[column.to_sym] = time
  end

  datestamp_columns.each do |column|
    timestamps[column.to_sym] = date
  end

  timestamps
end