Sha256: 548689c40d15598b01af06d574c5a99d74faa6db7a62b5d3c528b56d138245de
Contents?: true
Size: 744 Bytes
Versions: 45
Compression:
Stored size: 744 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(val.to_s.presence || 0) unless val.is_a?(BigDecimal) val end end end
Version data entries
45 entries across 45 versions & 1 rubygems