Methods
- V
Instance Public methods
validate( data, path = '' )
Link
Check if data is a valid String and return a Hoodoo::Errors instance.
Source: show
# File lib/hoodoo/presenters/types/text.rb, line 10 def validate( data, path = '' ) errors = super( data, path ) return errors if errors.has_errors? || ( ! @required && data.nil? ) unless data.is_a?( ::String ) errors.add_error( 'generic.invalid_string', :message => "Field `#{ full_path( path ) }` is an invalid string", :reference => { :field_name => full_path( path ) } ) end errors end