Sha256: bfd5c9de7c5d117378b17467cb9b1a8b457d0b71baa33bb2cf56469c26631ef0

Contents?: true

Size: 192 Bytes

Versions: 18

Compression:

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

18 entries across 18 versions & 2 rubygems

Version Path
RTALogger-2.1.2 lib/string.rb
RTALogger-2.1.1 lib/string.rb
RTALogger-2.1.0 lib/string.rb
RTALogger-2.0.2 lib/string.rb
RTALogger-2.0.1 lib/string.rb
RTALogger-2.0.0 lib/string.rb
RTALogger-1.1.1 lib/string.rb
RTALogger-1.1.0 lib/string.rb
ruby-redtail-0.3.8 lib/core_extensions/string.rb
ruby-redtail-0.3.7 lib/core_extensions/string.rb
ruby-redtail-0.3.6 lib/core_extensions/string.rb
ruby-redtail-0.3.5 lib/core_extensions/string.rb
ruby-redtail-0.3.4 lib/core_extensions/string.rb
ruby-redtail-0.3.3 lib/core_extensions/string.rb
ruby-redtail-0.3.2 lib/core_extensions/string.rb
ruby-redtail-0.3.1 lib/core_extensions/string.rb
ruby-redtail-0.3.0 lib/core_extensions/string.rb
ruby-redtail-0.2.0 lib/core_extensions/string.rb