class ActiverecordHoarder::Batch

Constants

RECORD_DATE_FIELD

Public Class Methods

from_records(record_data) click to toggle source
# File lib/activerecord_hoarder/batch.rb, line 5
def self.from_records(record_data)
  record_data.present? ? new(record_data) : nil
end
new(record_data) click to toggle source
# File lib/activerecord_hoarder/batch.rb, line 9
def initialize(record_data)
  @record_data = record_data
  @serializer = ::ActiverecordHoarder::Serializer
end

Public Instance Methods

content_string() click to toggle source
# File lib/activerecord_hoarder/batch.rb, line 22
def content_string
  @serializer.create_archive(@record_data)
end
date() click to toggle source
# File lib/activerecord_hoarder/batch.rb, line 14
def date
  @date ||= @record_data.first[RECORD_DATE_FIELD].to_date
end
key() click to toggle source
# File lib/activerecord_hoarder/batch.rb, line 18
def key
  @key ||= ::ActiverecordHoarder::StorageKey.from_date(date, @serializer.extension)
end