Sha256: 301d249adc567d932a992be5d2538bd085b713058d5cecd906b723a75686b579

Contents?: true

Size: 488 Bytes

Versions: 9

Compression:

Stored size: 488 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.deserialize(data).first
      end

      def dump(obj)
        data = Arguments.serialize [obj]
        data.to_json
      rescue ActiveJob::SerializationError
        raise UnserializableValue
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
acidic_job-1.0.0.beta.9 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.8 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.7 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.6 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.5 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.4 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.3 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.2 lib/acidic_job/serializer.rb
acidic_job-1.0.0.beta.1 lib/acidic_job/serializer.rb