Sha256: 30197d5c61b826317bd0e820440d3ddb54cf60792d5bdcda6b17058cda550afa

Contents?: true

Size: 341 Bytes

Versions: 2

Compression:

Stored size: 341 Bytes

Contents

module Simplabs

  module Excellent

    module Extensions #:nodoc:

      ::String.class_eval do

        def underscore
          to_s.gsub(/::/, '/').
            gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
            gsub(/([a-z\d])([A-Z])/,'\1_\2').
            tr("-", "_").
            downcase
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/extensions/string.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/extensions/string.rb