module PollyPhone::Utils
Public Instance Methods
clr_str(string)
click to toggle source
custom activesupport squish analog
# File lib/polly_phone/utils.rb, line 24 def clr_str(string) string.gsub(/\A[[:space:]]+/, '').gsub(/[[:space:]]+\z/, '').gsub(/[[:space:]]+/, ' ') end
symbolize_keys(hash)
click to toggle source
# File lib/polly_phone/utils.rb, line 6 def symbolize_keys(hash) hash.inject({}){|res, (key, val)| nkey = case key when String key.to_sym else key end nval = case val when Hash symbolize_keys(val) else val end res[nkey] = nval res } end