Sha256: d65e840c893a0c467ac88589a0461c3197cca3a3f95945c51012e35389b30347

Contents?: true

Size: 424 Bytes

Versions: 11

Compression:

Stored size: 424 Bytes

Contents

# frozen_string_literal: true

class Money
  module Rails
    class JobArgumentSerializer < ::ActiveJob::Serializers::ObjectSerializer
      def serialize(money)
        super("value" => money.value.to_s("F"), "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

11 entries across 11 versions & 1 rubygems

Version Path
shopify-money-3.0.0 lib/money/rails/job_argument_serializer.rb
shopify-money-2.2.2 lib/money/rails/job_argument_serializer.rb
shopify-money-2.2.1 lib/money/rails/job_argument_serializer.rb
shopify-money-2.2.0 lib/money/rails/job_argument_serializer.rb
shopify-money-2.0.0 lib/money/rails/job_argument_serializer.rb
shopify-money-1.3.0 lib/money/rails/job_argument_serializer.rb
shopify-money-1.2.1 lib/money/rails/job_argument_serializer.rb
shopify-money-1.2.0 lib/money/rails/job_argument_serializer.rb
shopify-money-1.1.2 lib/money/rails/job_argument_serializer.rb
shopify-money-1.1.1 lib/money/rails/job_argument_serializer.rb
shopify-money-1.1.0 lib/money/rails/job_argument_serializer.rb