Module: RSchema::Coercers::Float

Extended by:
Float
Included in:
Float
Defined in:
lib/rschema/coercers/float.rb

Instance Method Summary collapse

Instance Method Details

#build(schema) ⇒ Object



7
8
9
# File 'lib/rschema/coercers/float.rb', line 7

def build(schema)
  self
end

#call(value) ⇒ Object



11
12
13
14
# File 'lib/rschema/coercers/float.rb', line 11

def call(value)
  flt = Float(value) rescue nil
  flt ? Result.success(flt) : Result.failure
end

#will_affect?(value) ⇒ Boolean

Returns:



16
17
18
# File 'lib/rschema/coercers/float.rb', line 16

def will_affect?(value)
  not value.is_a?(Float)
end