Sha256: 9ffba3047fb6f7af31df7a702123db01fad4f778e54bc1f1952644d918edb0e1

Contents?: true

Size: 178 Bytes

Versions: 22

Compression:

Stored size: 178 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

22 entries across 22 versions & 2 rubygems

Version Path
majestic-api-1.4.2 lib/majestic/api/extensions/string.rb
majestic-api-1.4.1 lib/majestic/api/extensions/string.rb
majestic-api-1.4.0 lib/majestic/api/extensions/string.rb
majestic_seo_api-1.4.0 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.3.1 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.3.0 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.8 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.7 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.6 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.5 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.4 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.3 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.2 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2.1 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.2 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.1.3.1 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.1.3 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.1.2.1 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.1.2 lib/majestic_seo/extensions/string.rb
majestic_seo_api-1.1.1 lib/majestic_seo/extensions/string.rb