Sha256: 0d3ee33bb2828591eaa11159e3a39eca4ef6494f9551cd82daedb01e2136348f

Contents?: true

Size: 304 Bytes

Versions: 3

Compression:

Stored size: 304 Bytes

Contents

class String

  unless method_defined?(:underscore)
    define_method :underscore do
      word = self.dup
      word.gsub!(/::/, '/')
      word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
      word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
      word.tr!("-", "_")
      word.downcase!
      word
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facturae_print-0.0.4 lib/facturae_print/core_ext/string.rb
facturae_print-0.0.3 lib/facturae_print/core_ext/string.rb
facturae_print-0.0.2 lib/facturae_print/core_ext/string.rb