Module: ActiveElement::Components::PhoneFields

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

Overview

Provides a convenience method for detecting a field should be classified as a phone number.

Constant Summary collapse

PHONE_FIELDS =
%w[phone telephone tel mobile].freeze

Instance Method Summary collapse

Instance Method Details

#phone_field?(field) ⇒ Boolean

Returns:

  • (Boolean)


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

def phone_field?(field)
  PHONE_FIELDS.any? { |phone_field| field.to_s.downcase.split('_').include?(phone_field) }
end