class Hoodoo::Presenters::Float
A JSON Float
schema member.
Public Instance Methods
validate( data, path = '' )
click to toggle source
Check if data is a valid Float
and return a Hoodoo::Errors
instance.
Calls superclass method
Hoodoo::Presenters::Field#validate
# File lib/hoodoo/presenters/types/float.rb, line 10 def validate( data, path = '' ) errors = super( data, path ) return errors if errors.has_errors? || ( ! @required && data.nil? ) unless data.is_a?( ::Float ) errors.add_error( 'generic.invalid_float', :message => "Field `#{ full_path( path ) }` is an invalid float", :reference => { :field_name => full_path( path ) } ) end errors end