Class: Bureaucrat::Fields::EmailField

Inherits:
RegexField show all
Defined in:
lib/bureaucrat/fields.rb

Constant Summary collapse

EMAIL_RE =

Original from Django’s EmailField: email_re = re.compile(

r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
r')@(?:[A-Z0-9]+(?:-*[A-Z0-9]+)*\.)+[A-Z]{2,6}$', re.IGNORECASE)  # domain
/(^[-!#\$%&'*+\/=?^_`{}|~0-9A-Z]+(\.[-!#\$%&'*+\/=?^_`{}|~0-9A-Z]+)*|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*")@(?:[A-Z0-9]+(?:-*[A-Z0-9]+)*\.)+[A-Z]{2,6}$/i

Instance Attribute Summary

Attributes inherited from CharField

#max_length, #min_length

Attributes inherited from Field

#error_messages, #help_text, #hidden_widget, #initial, #label, #required, #show_hidden_initial, #widget

Instance Method Summary collapse

Methods inherited from RegexField

#clean

Methods inherited from CharField

#clean, #widget_attrs

Methods inherited from Field

#clean, hidden_widget, inherited, #initialize_copy, set_error, #validating, widget, #widget_attrs

Methods included from Validation::Converters

to_big_decimal, to_bool, to_float, to_integer

Methods included from Validation::Validates

fail_with

Methods included from Validation::Validators

empty_value?, has_max_decimal_places, has_max_digits, has_max_length, has_max_whole_digits, has_min_length, included_in, is_array, is_email, is_not_greater_than, is_not_lesser_than, is_present, is_true, matches_regex, not_empty

Constructor Details

#initialize(options = {}) ⇒ EmailField

Returns a new instance of EmailField.



287
288
289
# File 'lib/bureaucrat/fields.rb', line 287

def initialize(options={})
  super(EMAIL_RE, options)
end