Module: CMDx::Coercions::Float
Overview
Coerces to Float via ‘Kernel#Float` (strict parsing; no silent zero).
Instance Method Summary collapse
Instance Method Details
#call(value, options = EMPTY_HASH) ⇒ Float, Coercions::Failure
14 15 16 17 18 19 |
# File 'lib/cmdx/coercions/float.rb', line 14 def call(value, = EMPTY_HASH) Float(value) rescue ArgumentError, RangeError, TypeError type = I18nProxy.t("cmdx.types.float") Failure.new(I18nProxy.t("cmdx.coercions.into_a", type:)) end |