Sha256: 4c4d8fab8cdd1d4590c84542b46644a98271ea9376460bb95e42bb84a415efd1
Contents?: true
Size: 297 Bytes
Versions: 8
Compression:
Stored size: 297 Bytes
Contents
class String # Borrowed from ActiveSupport, this converts camel-case Strings to # snake-case. # # @return [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 end
Version data entries
8 entries across 8 versions & 1 rubygems