Sha256: 9ada64104fbd3f4f290ca64cfdd974cfe210cff52909e64e95c50f757c36d744
Contents?: true
Size: 296 Bytes
Versions: 5
Compression:
Stored size: 296 Bytes
Contents
class String def underscore self.gsub(/.+::/, ''). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end def camelcase return self if self !~ /_/ && self =~ /[A-Z]+.*/ split('_').map{|e| e.capitalize}.join end end
Version data entries
5 entries across 5 versions & 1 rubygems