Class: Agilibox::PhoneNumberSanitizer

Inherits:
Object
  • Object
show all
Defined in:
app/libs/agilibox/phone_number_sanitizer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone_number) ⇒ PhoneNumberSanitizer

Returns a new instance of PhoneNumberSanitizer.



4
5
6
# File 'app/libs/agilibox/phone_number_sanitizer.rb', line 4

def initialize(phone_number)
  @phone_number = phone_number
end

Instance Attribute Details

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



2
3
4
# File 'app/libs/agilibox/phone_number_sanitizer.rb', line 2

def phone_number
  @phone_number
end

Class Method Details

.call(*args) ⇒ Object



12
13
14
# File 'app/libs/agilibox/phone_number_sanitizer.rb', line 12

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



8
9
10
# File 'app/libs/agilibox/phone_number_sanitizer.rb', line 8

def call
  phone_number.to_s.gsub(/[^0-9\+]+/, "").presence
end