A JSON Integer schema member.

Methods
V
Instance Public methods
validate( data, path = '' )

Check if data is a valid Integer and return a Hoodoo::Errors instance.

# File lib/hoodoo/presenters/types/integer.rb, line 10
def validate( data, path = '' )
  errors = super( data, path )
  return errors if errors.has_errors? || ( ! @required && data.nil? )

  unless data.is_a?( ::Integer )
    errors.add_error(
      'generic.invalid_integer',
      :message   => "Field `#{ full_path( path ) }` is an invalid integer",
      :reference => { :field_name => full_path( path ) }
    )
  end

  errors
end