Class: ReeNumber::NumberToPhone
- Inherits:
-
Object
- Object
- ReeNumber::NumberToPhone
- Includes:
- Ree::FnDSL
- Defined in:
- lib/ree_lib/packages/ree_number/package/ree_number/functions/number_to_phone.rb
Constant Summary collapse
- DEFAULT_PHONE_PATTERN =
/(\d{0,3})(\d{3})(\d{4})$/
- DEFAULT_AREA_PHONE_PATTERN =
/(\d{1,3})(\d{3})(\d{4}$)/
- DEFAULTS =
{ delimiter: "-" }.freeze
Instance Method Summary collapse
Instance Method Details
#call(number, **opts) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ree_lib/packages/ree_number/package/ree_number/functions/number_to_phone.rb', line 37 def call(number, **opts) = DEFAULTS.merge(opts) str = country_code([:country_code], [:delimiter]).dup str << convert_to_phone_number( number.to_s.strip, [:delimiter], [:area_code], [:pattern] ) str << phone_extension([:extension]) if [:extension] str end |