Sha256: ad262c9acf61abc432eebc3c8d6dac673d2b45b1c6029461e8be72d46fa52f8b
Contents?: true
Size: 736 Bytes
Versions: 13
Compression:
Stored size: 736 Bytes
Contents
# Author:: Ondřej Ezr (mailto:oezr@msp.justice.cz) # Copyright:: Copyright (c) 2018 Ministry of Justice # License:: Distributes under license Open Source Licence pro Veřejnou Správu a Neziskový Sektor v.1 module AzaharaSchemaCurrency class CurrencyAttribute < AzaharaSchema::Attribute def initialize(model, name, type='currency', **options) super(model, name, type) @options = options end def currency_code_col @options[:currency_code_method] || 'currency_code' end def currency_code(entity) entity.try(currency_code_col) end def value(record) val = super(record) val = BigDecimal.new( val.to_s ) unless val.is_a?(BigDecimal) val end end end
Version data entries
13 entries across 13 versions & 1 rubygems