Sha256: 1533fdc209123971772df28048b416881c855a8739b99e867465bff6c69c3f6b
Contents?: true
Size: 415 Bytes
Versions: 9
Compression:
Stored size: 415 Bytes
Contents
require "bigdecimal" require "bigdecimal/util" module Cascade module ComplexFields class Currency def call(value) value = normalized_value(value) value.to_d if valid?(value) end private def normalized_value(value) String(value).tr(",", ".").tr(" ", "") end def valid?(value) true if Float(value) rescue false end end end end
Version data entries
9 entries across 9 versions & 1 rubygems