Module: TwilioLookups::REST::Utils
- Included in:
- BaseClient, InstanceResource, ListResource, Lookups::PhoneNumbers
- Defined in:
- lib/twilio-lookups/rest/utils.rb
Instance Method Summary collapse
Instance Method Details
#detwilify(something) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/twilio-lookups/rest/utils.rb', line 13 def detwilify(something) return key_map(something, :detwilify) if something.is_a? Hash string = something.to_s string = string[0,1].downcase + string[1..-1] string.gsub(/[A-Z][a-z]*/) { |s| "_#{s.downcase}" } end |
#twilify(something) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/twilio-lookups/rest/utils.rb', line 5 def twilify(something) return key_map(something, :twilify) if something.is_a? Hash string = something.to_s string.split('_').map do |string_part| string_part[0,1].capitalize + string_part[1..-1] end.join end |