Sha256: d7134e91b704a38c920bd8ab2af44897d5df793d16e827cfb4c7e0778538d6b7
Contents?: true
Size: 562 Bytes
Versions: 1
Compression:
Stored size: 562 Bytes
Contents
require 'hashie/mash' module Hashie class Rash < Mash protected def convert_key(key) #:nodoc: underscore_string(key.to_s) end # converts a camel_cased string to a underscore string # subs spaces with underscores, strips whitespace # Same way ActiveSupport does string.underscore def underscore_string(str) str.to_s.strip. gsub(' ', '_'). gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faraday_middleware-0.6.0 | lib/faraday_middleware/support/rash.rb |