Sha256: f6b4002e53e32c9d131ece52b3aed194b384ff7212d2bbb1d1239adb069b1490
Contents?: true
Size: 537 Bytes
Versions: 8
Compression:
Stored size: 537 Bytes
Contents
# frozen_string_literal: true module BingAdsRubySdk module StringUtils def self.camelize(string) string.split(UNDERSCORE).collect!{ |w| w.capitalize }.join end def self.snakize(string) string.gsub(MULTIPLE_CAPSREGEX, MATCHING_PATTERN) .gsub(SPLIT_REGEX, MATCHING_PATTERN) .tr('-', '_') .downcase .to_sym end UNDERSCORE = '_' MULTIPLE_CAPSREGEX = /([A-Z]+)([A-Z][a-z])/ SPLIT_REGEX = /([a-z\d])([A-Z])/ MATCHING_PATTERN = '\1_\2' end end
Version data entries
8 entries across 8 versions & 1 rubygems