Sha256: bb13358fe0e126d2545e7fb45fabf552351ed255145145cac6d6d21bc6fe5b96

Contents?: true

Size: 179 Bytes

Versions: 35

Compression:

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

35 entries across 35 versions & 2 rubygems

Version Path
maccman-bowline-0.4.6 lib/bowline/ext/string.rb
maccman-bowline-0.4.7 lib/bowline/ext/string.rb
maccman-bowline-0.4.8 lib/bowline/ext/string.rb
bowline-0.5.8 lib/bowline/ext/string.rb
bowline-0.5.7 lib/bowline/ext/string.rb
bowline-0.5.6 lib/bowline/ext/string.rb
bowline-0.5.5 lib/bowline/ext/string.rb
bowline-0.5.4 lib/bowline/ext/string.rb
bowline-0.5.3 lib/bowline/ext/string.rb
bowline-0.5.2 lib/bowline/ext/string.rb
bowline-0.5.1 lib/bowline/ext/string.rb
bowline-0.5.0 lib/bowline/ext/string.rb
bowline-0.4.6 lib/bowline/ext/string.rb
bowline-0.3.9 lib/bowline/ext/string.rb
bowline-0.1.6 lib/bowline/ext/string.rb