Class: InferModel::Parsers::Decimal
- Inherits:
-
Object
- Object
- InferModel::Parsers::Decimal
- Extended by:
- Dry::Initializer, Callable
- Defined in:
- lib/infer_model/parsers/decimal.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/infer_model/parsers/decimal.rb', line 11 def call raise Parsers::Error, "value was blank which is not allowed" if value.nil? && !allow_blank return if value.nil? || value.empty? Float(value) rescue ArgumentError raise Parsers::Error, "'#{value}' is not a Decimal" end |