Sha256: b3479e5acc2b6bfc0c43e9968c0e9b268521b23c7c7d2820526962fdec9cc4bd
Contents?: true
Size: 628 Bytes
Versions: 4
Compression:
Stored size: 628 Bytes
Contents
module Twilio module REST module Utils def twilify(something) if something.is_a? Hash Hash[*something.to_a.map {|a| [twilify(a[0]).to_sym, a[1]]}.flatten(1)] else something.to_s.split('_').map do |s| [s[0,1].capitalize, s[1..-1]].join end.join end end def detwilify(something) if something.is_a? Hash Hash[*something.to_a.map {|pair| [detwilify(pair[0]).to_sym, pair[1]]}.flatten] else something.to_s.gsub(/[A-Z][a-z]*/) {|s| "_#{s.downcase}"}.gsub(/^_/, '') end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems