Sha256: 9c2425016d2c7c7f6af1a83d788a93da2e68bfd5296cd8e4587c1c3cd992c273

Contents?: true

Size: 240 Bytes

Versions: 4

Compression:

Stored size: 240 Bytes

Contents

module HashieModel
  class Money < ::Money
    def self.coerce(value)
      cents = value.is_a?(Money) ? value.cents : value.to_money(:USD).cents
      new(cents, :USD)
    end
    
    def as_json(options=nil)
      to_s
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hashie-model-1.2.0 lib/hashie_model/money.rb
hashie-model-1.1.0 lib/hashie_model/money.rb
hashie-model-1.0.1 lib/hashie_model/money.rb
hashie-model-1.0.0.alpha lib/hashie_model/money.rb