module Zerial::MoneySerializer
Public Class Methods
as_json(object)
click to toggle source
# File lib/zerial/money_serializer.rb, line 6 def self.as_json (object) { "cents" => object.cents, "currency" => object.currency_as_string } end
from_loaded_json(json)
click to toggle source
# File lib/zerial/money_serializer.rb, line 13 def self.from_loaded_json (json) Money.new( json.fetch("cents"), json.fetch("currency") ) end