Module: ActiveElement::Components::EmailFields

Included in:
Util::FormFieldMapping
Defined in:
lib/active_element/components/email_fields.rb

Overview

Provides a convenience method for detecting a field should be classified as an email address.

Constant Summary collapse

EMAIL_FIELDS =
%w[email email_address].freeze

Instance Method Summary collapse

Instance Method Details

#email_field?(field) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/active_element/components/email_fields.rb', line 9

def email_field?(field)
  EMAIL_FIELDS.any? { |email_field| field.to_s.downcase == email_field }
end