Class: Typero::EmailType
- Defined in:
- lib/typero/type/types/email_type.rb
Constant Summary
Constants inherited from Type
Type::ERRORS, Type::OPTS, Type::OPTS_KEYS
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
Methods inherited from Type
allowed_opt?, #db_field, db_schema, #default, error, #get, #initialize, load, opts, #value
Constructor Details
This class inherits a constructor from Typero::Type
Instance Method Details
#db_schema ⇒ Object
14 15 16 17 18 |
# File 'lib/typero/type/types/email_type.rb', line 14 def db_schema [:string, { limit: @opts[:max] || 120 }] end |
#set ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/typero/type/types/email_type.rb', line 5 def set value do |email| email.downcase.gsub(/\s+/,'+') end error_for(:not_8_chars_error) unless value.to_s.length > 7 error_for(:missing_monkey_error) unless value.include?('@') end |