Sha256: 836fdf364c10399d01aa1c4eaa5fa5ac349b48ca37859b02022dafd966c08b7b
Contents?: true
Size: 776 Bytes
Versions: 14
Compression:
Stored size: 776 Bytes
Contents
# frozen_string_literal: true require 'pi_resources/serializer/object_serializer' module PiResources module Serializer class MoneySerializer include ObjectSerializer attribute :cents, method: :cents attribute :amount, method: :amount attribute :currency, method: :currency attribute :formatted_text, method: :formatted_text attribute :symbol, method: :symbol def cents(record) record.cents end def amount(record) record.to_f end def currency(record) record.currency.iso_code end def formatted_text(record) record.format(symbol: "#{record.currency.symbol} ") end def symbol(record) record.currency.symbol end end end end
Version data entries
14 entries across 14 versions & 1 rubygems