Class: Libis::Workflow::ActiveRecord::Helpers::StatusSerializer
- Inherits:
-
Object
- Object
- Libis::Workflow::ActiveRecord::Helpers::StatusSerializer
- Defined in:
- lib/libis/workflow/activerecord/helpers/status_serializer.rb
Class Method Summary collapse
Class Method Details
.dump(array) ⇒ Object
10 11 12 13 |
# 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) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# 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 |