Class: Extant::Coercers::Float

Inherits:
Base
  • Object
show all
Defined in:
lib/extant/coercers/float.rb

Constant Summary

Constants inherited from Base

Base::UncoercedValue

Instance Method Summary collapse

Methods inherited from Base

#coerced?, coercer_name, #initialize

Constructor Details

This class inherits a constructor from Extant::Coercers::Base

Instance Method Details

#coerceObject



3
4
5
6
7
8
9
# File 'lib/extant/coercers/float.rb', line 3

def coerce
  result = Float(value)
  self.coerced = true
  result
rescue ArgumentError, TypeError
  UncoercedValue
end