Class: Agilibox::PhoneNumberSanitizer
- Inherits:
-
Object
- Object
- Agilibox::PhoneNumberSanitizer
- Defined in:
- app/libs/agilibox/phone_number_sanitizer.rb
Instance Attribute Summary collapse
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(phone_number) ⇒ PhoneNumberSanitizer
constructor
A new instance of PhoneNumberSanitizer.
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_number ⇒ Object (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
#call ⇒ Object
8 9 10 |
# File 'app/libs/agilibox/phone_number_sanitizer.rb', line 8 def call phone_number.to_s.gsub(/[^0-9\+]+/, "").presence end |