Sha256: 68f3df4bc8233eababb305ceb852e3a411b09423d6847c797653778cab9a3484
Contents?: true
Size: 297 Bytes
Versions: 4
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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tailor-1.4.1 | lib/ext/string_ext.rb |
tailor-1.4.0 | lib/ext/string_ext.rb |
tailor-1.3.1 | lib/ext/string_ext.rb |
tailor-1.3.0 | lib/ext/string_ext.rb |