Sha256: d65834e3552ba73bba96b8f285899998ed2a441d46fa0badabc7e283fbf2a8cc

Contents?: true

Size: 511 Bytes

Versions: 10

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

require "json"

module AcidicJob
  class Serializer
    # Used for `serialize` method in ActiveRecord
    class << self
      def load(json)
        return if json.nil? || json.empty?

        data = JSON.parse(json)
        Arguments.send :deserialize_argument, data
      end

      def dump(obj)
        data = Arguments.send :serialize_argument, obj
        data.to_json
      rescue ActiveJob::SerializationError
        raise UnserializableValue
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
acidic_job-0.9.0 lib/acidic_job/serializer.rb
acidic_job-0.8.8 lib/acidic_job/serializer.rb
acidic_job-0.8.7 lib/acidic_job/serializer.rb
acidic_job-0.8.5 lib/acidic_job/serializer.rb
acidic_job-0.8.4 lib/acidic_job/serializer.rb
acidic_job-0.8.3 lib/acidic_job/serializer.rb
acidic_job-0.8.2 lib/acidic_job/serializer.rb
acidic_job-0.8.1 lib/acidic_job/serializer.rb
acidic_job-0.8.0 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.10 lib/acidic_job/serializer.rb