Class: TTY::Coercer::Float
- Inherits:
-
Object
- Object
- TTY::Coercer::Float
- Defined in:
- lib/tty/coercer/float.rb
Class Method Summary collapse
Class Method Details
.coerce(value, strict = true) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tty/coercer/float.rb', line 8 def self.coerce(value, strict=true) begin Kernel.send(:Float, value.to_s) rescue if strict raise InvalidArgument, "#{value} could not be coerced into Float" else value.to_f end end end |