Module: AttributeNormalizer::Normalizers::PhoneNormalizer

Defined in:
lib/attribute_normalizer/normalizers/phone_normalizer.rb

Class Method Summary collapse

Class Method Details

.normalize(value, options = {}) ⇒ Object


4
5
6
7
# File 'lib/attribute_normalizer/normalizers/phone_normalizer.rb', line 4

def self.normalize(value, options = {})
  value = value.is_a?(String) ? value.gsub(/[^0-9]+/, '') : value
  value.is_a?(String) && value.empty? ? nil : value
end