Module: Identity::Parsers::GCIdsHelper
- Included in:
- IAMUserIdentity, GCIds
- Defined in:
- lib/identity/parsers/gc_ids_helper.rb
Instance Method Summary collapse
-
#sanitize_edipi(edipi) ⇒ String
A string of 10 numerical digits representing the sanitized id.
-
#sanitize_id(id) ⇒ String
A string of any number of numerical digits representing the sanitized id.
-
#sanitize_id_array(ids) ⇒ Array<String>
An array of strings of any number of numerical digits representing the sanitized id.
Instance Method Details
#sanitize_edipi(edipi) ⇒ String
Returns A string of 10 numerical digits representing the sanitized id.
8 9 10 11 12 13 |
# File 'lib/identity/parsers/gc_ids_helper.rb', line 8 def sanitize_edipi(edipi) return unless edipi.present? && edipi.is_a?(String) # Remove non-digit characters from input, and match the first contiguous 10 digits found edipi.match(/\d{10}/)&.to_s end |
#sanitize_id(id) ⇒ String
Returns A string of any number of numerical digits representing the sanitized id.
17 18 19 20 21 22 |
# File 'lib/identity/parsers/gc_ids_helper.rb', line 17 def sanitize_id(id) return unless id.present? && id.is_a?(String) # Remove non-digit characters from input id.match(/\d+/)&.to_s end |
#sanitize_id_array(ids) ⇒ Array<String>
Returns An array of strings of any number of numerical digits representing the sanitized id.
26 27 28 29 30 |
# File 'lib/identity/parsers/gc_ids_helper.rb', line 26 def sanitize_id_array(ids) return [] unless ids.present? && ids.is_a?(Array) ids.map { |id| sanitize_id(id) }.compact end |