Sha256: 23d590eef3518b7f8f2a99e712df63eaf6379d8f7a66327ebcd53bb05be0938c

Contents?: true

Size: 185 Bytes

Versions: 8

Compression:

Stored size: 185 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
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
haveapi-fs-0.11.0 lib/core_ext/string.rb
haveapi-fs-0.10.0 lib/core_ext/string.rb
haveapi-fs-0.9.0 lib/core_ext/string.rb
haveapi-fs-0.8.0 lib/core_ext/string.rb
haveapi-fs-0.7.1 lib/core_ext/string.rb
haveapi-fs-0.7.0 lib/core_ext/string.rb
clubhouse.io-ruby-0.1.0 lib/clubhouse/ext/string.rb
haveapi-fs-0.1.0 lib/core_ext/string.rb