Module: Securial::Helpers::NormalizingHelper
- Extended by:
- NormalizingHelper
- Included in:
- NormalizingHelper
- Defined in:
- lib/securial/helpers/normalizing_helper.rb
Overview
Provides data normalization methods for common input sanitization.
This module contains methods to normalize various types of user input to ensure data consistency and prevent common formatting issues that could lead to duplicate records or authentication problems.
Instance Method Summary collapse
-
#normalize_email_address(email) ⇒ String
Normalizes an email address for consistent storage and comparison.
-
#normalize_role_name(role_name) ⇒ String
Normalizes a role name for consistent display and storage.
Instance Method Details
#normalize_email_address(email) ⇒ String
Normalizes an email address for consistent storage and comparison.
Strips whitespace and converts to lowercase to ensure email addresses are stored consistently regardless of how users input them. This prevents duplicate accounts and authentication issues caused by case sensitivity.
50 51 52 53 54 |
# File 'lib/securial/helpers/normalizing_helper.rb', line 50 def normalize_email_address(email) return "" if email.empty? email.strip.downcase end |
#normalize_role_name(role_name) ⇒ String
Normalizes a role name for consistent display and storage.
Strips whitespace, converts to lowercase, then applies title case formatting to ensure role names are displayed consistently across the application. This helps maintain a professional appearance and prevents formatting issues.
81 82 83 84 85 |
# File 'lib/securial/helpers/normalizing_helper.rb', line 81 def normalize_role_name(role_name) return "" if role_name.empty? role_name.strip.downcase.titleize end |