Sha256: a3b7cc2d1d3c60b99b3b099642a4123707ed16ca003f91183aac89e00bbe781d

Contents?: true

Size: 380 Bytes

Versions: 2

Compression:

Stored size: 380 Bytes

Contents

module Simplabs

  module Excellent

    module Core

      module Extensions

        ::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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.0.0 lib/simplabs/excellent/core/extensions/underscore.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/core/extensions/underscore.rb