class Libis::Workflow::ActiveRecord::Helpers::StatusSerializer

Public Class Methods

dump(array) click to toggle source
# File lib/libis/workflow/activerecord/helpers/status_serializer.rb, line 10
def self.dump(array)
  return nil unless array.is_a?(Array) && !array.empty?
  array || []
end
load(array) click to toggle source
# File lib/libis/workflow/activerecord/helpers/status_serializer.rb, line 15
def self.load(array)
  (array || []).map do |status|
    status = status.with_indifferent_access
    status[:status] = status[:status].to_sym if status.has_key? :status
    status[:created] = DateTime.parse(status[:created]) if status.has_key? :created
    status[:updated] = DateTime.parse(status[:updated]) if status.has_key? :updated
    status
  end
end