Sha256: c856b1eb2a515d08ab80d48b2acd7b1431171d40c78357e83bb4841718866ac4

Contents?: true

Size: 414 Bytes

Versions: 2

Compression:

Stored size: 414 Bytes

Contents

# frozen_string_literal: true

class Money
  module Rails
    class JobArgumentSerializer < ::ActiveJob::Serializers::ObjectSerializer
      def serialize(money)
        super("value" => money.value, "currency" => money.currency.iso_code)
      end

      def deserialize(hash)
        Money.new(hash["value"], hash["currency"])
      end

      private

      def klass
        Money
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shopify-money-1.0.2.pre lib/money/rails/job_argument_serializer.rb
shopify-money-1.0.1.pre lib/money/rails/job_argument_serializer.rb