Sha256: 59f2d821342b8085d05d6db65ce3e69ffb4ddb9ddf383a93f508ef195c7d2276
Contents?: true
Size: 684 Bytes
Versions: 13
Compression:
Stored size: 684 Bytes
Contents
# frozen_string_literal: true module ActiveResource class ActiveJobSerializer < ActiveJob::Serializers::ObjectSerializer def serialize(resource) super( "class" => resource.class.name, "persisted" => resource.persisted?, "prefix_options" => resource.prefix_options.as_json, "attributes" => resource.attributes.as_json ) end def deserialize(hash) hash["class"].constantize.new(hash["attributes"]).tap do |resource| resource.persisted = hash["persisted"] resource.prefix_options = hash["prefix_options"] end end private def klass ActiveResource::Base end end end
Version data entries
13 entries across 13 versions & 2 rubygems