Sha256: d9991aa4d37d3319a952f29d2f827843a9b7a0d941dbf3edb5885377745360ec

Contents?: true

Size: 373 Bytes

Versions: 4

Compression:

Stored size: 373 Bytes

Contents

module HasPrice
  module CoreExtensions
    module String
      # In case we're not in Rails.
      #
      # @see http://api.rubyonrails.org/classes/Inflector.html#M001631
      def underscore
        gsub(/::/, '/').
        gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
        gsub(/([a-z\d])([A-Z])/,'\1_\2').
        tr("-", "_").
        downcase
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
has_price-1.2.0 lib/has_price/core_extensions/string.rb
has_price-1.1.1 lib/has_price/core_extensions/string.rb
has_price-1.1.0 lib/has_price/core_extensions/string.rb
has_price-1.0.0 lib/has_price/core_extensions/string.rb