Sha256: 6caad8814e1499948c18cd7b197ab50333a17b4aa3d293680adf7fba17470975
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 Bytes
Contents
class String ## # Replace _hash_ keys with associated values. Mutative. def tokenize! hash hash.each_pair do |k, v| self.gsub! Regexp.new(":#{k}"), v.to_s end self end ## # Replace _hash_ keys with associated values. def tokenize hash self.dup.tokenize! hash end ## # Converts a string to camelcase. def camelcase upcase_first_letter = true up = upcase_first_letter str = dup str.gsub!(/\/(.?)/){ "::#{$1.upcase}" } str.gsub!(/(?:_+|-+)([a-z])/){ $1.upcase } str.gsub!(/(\A|\s)([a-z])/){ $1 + $2.upcase } if up str end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
visionmedia-commander-2.4.2 | lib/commander/core_ext/string.rb |