Sha256: 7639af7bdbc745ee56a96b991e86e307ec700015acd898093669e695df75bfcc

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module ActiveRecordDataLoader
  module ActiveRecord
    class DatetimeValueGenerator
      class << self
        def generator_for(model_class:, ar_column:)
          ->(row) { timestamp(model_class, row) }
        end

        private

        def timestamp(model, row_number)
          PerRowValueCache[:datetime].get_or_set(model: model, row: row_number) do
            Time.now.utc
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_record_data_loader-1.0.1 lib/active_record_data_loader/active_record/datetime_value_generator.rb