Module: ActiveElement::Components::SecretFields

Included in:
CollectionTable, ItemTable, Util::FormFieldMapping
Defined in:
lib/active_element/components/secret_fields.rb

Overview

Provides a convenience method for detecting a field should be classified as a secret, used for censoring values or selecting the default form field type as ‘password_field`, etc.

Constant Summary collapse

SECRET_FIELDS =
%w[secret password].freeze

Instance Method Summary collapse

Instance Method Details

#secret_field?(field) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/active_element/components/secret_fields.rb', line 10

def secret_field?(field)
  SECRET_FIELDS.any? { |secret_field| field.to_s.downcase.include?(secret_field) }
end