Module: WolfCore::StringUtils

Defined in:
lib/wolf_core/utils/string_utils.rb

Instance Method Summary collapse

Instance Method Details

#camelcase_to_spaces(str) ⇒ Object



3
4
5
6
# File 'lib/wolf_core/utils/string_utils.rb', line 3

def camelcase_to_spaces(str)
  return if str.nil?
  str.gsub(/([A-Z])/, ' \1').strip.downcase.capitalize
end

#clean_phone_number(phone) ⇒ Object



8
9
10
11
12
# File 'lib/wolf_core/utils/string_utils.rb', line 8

def clean_phone_number(phone)
  cleaned_phone = phone.gsub(/\D/, '')
  last_ten_digits = cleaned_phone[-10, 10]
  last_ten_digits
end