Sha256: b1ea2baff4e77e9bd24aabc17c8a2ca39808ed8bffe81561452e5f134208fd00

Contents?: true

Size: 248 Bytes

Versions: 3

Compression:

Stored size: 248 Bytes

Contents

class String
  def cm_underscore!
    self.gsub(/::/, '/').
        gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
        gsub(/([a-z\d])([A-Z])/,'\1_\2').
        tr("-", "_").
        downcase!
  end

  def cm_underscore
    dup.cm_underscore!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
check_mobi-1.0.5 lib/check_mobi/core_ext/string.rb
check_mobi-1.0.4 lib/check_mobi/core_ext/string.rb
check_mobi-1.0.3 lib/check_mobi/core_ext/string.rb