Sha256: 8aa5d4f6ef0cb23f721f7a07821632d7b7b41549b974baed0426f24514313285

Contents?: true

Size: 408 Bytes

Versions: 19

Compression:

Stored size: 408 Bytes

Contents

# frozen_string_literal: true

module ActiveElement
  module Components
    # Provides a convenience method for detecting a field should be classified as a phone number.
    module PhoneFields
      PHONE_FIELDS = %w[phone telephone tel mobile].freeze

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
active_element-0.0.31 lib/active_element/components/phone_fields.rb
active_element-0.0.30 lib/active_element/components/phone_fields.rb
active_element-0.0.29 lib/active_element/components/phone_fields.rb
active_element-0.0.28 lib/active_element/components/phone_fields.rb
active_element-0.0.27 lib/active_element/components/phone_fields.rb
active_element-0.0.26 lib/active_element/components/phone_fields.rb
active_element-0.0.24 lib/active_element/components/phone_fields.rb
active_element-0.0.23 lib/active_element/components/phone_fields.rb
active_element-0.0.22 lib/active_element/components/phone_fields.rb
active_element-0.0.21 lib/active_element/components/phone_fields.rb
active_element-0.0.19 lib/active_element/components/phone_fields.rb
active_element-0.0.18 lib/active_element/components/phone_fields.rb
active_element-0.0.17 lib/active_element/components/phone_fields.rb
active_element-0.0.16 lib/active_element/components/phone_fields.rb
active_element-0.0.15 lib/active_element/components/phone_fields.rb
active_element-0.0.14 lib/active_element/components/phone_fields.rb
active_element-0.0.13 lib/active_element/components/phone_fields.rb
active_element-0.0.12 lib/active_element/components/phone_fields.rb
active_element-0.0.11 lib/active_element/components/phone_fields.rb