Sha256: 494f83d87e5b13ac34dee1cc2581517488efa9cc8d84ec7db4dcfce631f4403a
Contents?: true
Size: 388 Bytes
Versions: 12
Compression:
Stored size: 388 Bytes
Contents
class String # converts a camel cased word to an underscored word def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end # Gets the constant when it is defined that corresponds to this string def classify Object.const_get self end end
Version data entries
12 entries across 12 versions & 2 rubygems