class Eatr::Transformation::AddDateId

Public Class Methods

new(args) click to toggle source
# File lib/eatr/transformation/add_date_id.rb, line 4
def initialize(args)
  @source = args.fetch('source')
  @destination = args.fetch('destination')
end

Public Instance Methods

call(*objs) click to toggle source
# File lib/eatr/transformation/add_date_id.rb, line 9
def call(*objs)
  Array(objs.flatten).map do |o|
    if !o[@source].nil?
      o[@destination] = o[@source].strftime('%Y%m%d').to_i
    end

    o
  end
end