A JSON Float schema member.
Methods
- V
Instance Public methods
validate( data, path = '' )
Link
Check if data is a valid Float and return a Hoodoo::Errors instance.
Source: show
# 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