Sha256: f317e5d6e7a520527e048309d2ec3984dbed4247ece68db65293960caed491d8
Contents?: true
Size: 772 Bytes
Versions: 2
Compression:
Stored size: 772 Bytes
Contents
module ZendeskAPI module Helpers # From https://github.com/rubyworks/facets/blob/master/lib/core/facets/string/modulize.rb def self.modulize_string(string) #gsub('__','/'). # why was this ever here? string.gsub(/__(.?)/){ "::#{$1.upcase}" }. gsub(/\/(.?)/){ "::#{$1.upcase}" }. gsub(/(?:_+|-+)([a-z])/){ $1.upcase }. gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase } end # From https://github.com/rubyworks/facets/blob/master/lib/core/facets/string/snakecase.rb def self.snakecase_string(string) #gsub(/::/, '/'). string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr('-', '_'). gsub(/\s/, '_'). gsub(/__+/, '_'). downcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zendesk_api-0.1.7 | lib/zendesk_api/helpers.rb |
zendesk_api-0.1.6 | lib/zendesk_api/helpers.rb |