Sha256: 40a2d1e857c54022b4fc5f6c8ac4556d0c28dfc7eaebbd462ba93437b5ce05b3

Contents?: true

Size: 190 Bytes

Versions: 8

Compression:

Stored size: 190 Bytes

Contents

class String
  def underscore
    self.to_s.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 & 1 rubygems

Version Path
cdyne-sms-notify-1.0.6 lib/ext/string.rb
cdyne-sms-notify-1.0.4 lib/ext/string.rb
cdyne-sms-notify-1.0.3 lib/ext/string.rb
cdyne-sms-notify-1.0.2 lib/ext/string.rb
cdyne-sms-notify-1.0.1 lib/ext/string.rb
cdyne-sms-notify-1.0.0 lib/ext/string.rb
cdyne-sms-notify-0.10.1 lib/ext/string.rb
cdyne-sms-notify-0.10.0 lib/ext/string.rb