Sha256: d01add36c166574131928044caec9dacf9e3c4944a1b0971fb8c05dc3e255299
Contents?: true
Size: 813 Bytes
Versions: 43
Compression:
Stored size: 813 Bytes
Contents
module Postmark module HashHelper extend self def to_postmark(hash) hash.inject({}) { |m, (k,v)| m[Inflector.to_postmark(k)] = v; m } end def to_ruby(hash, compatible = false) formatted = hash.inject({}) { |m, (k,v)| m[Inflector.to_ruby(k)] = v; m } if compatible formatted.merge!(hash) enhance_with_compatibility_warning(formatted) end formatted end protected def enhance_with_compatibility_warning(hash) def hash.[](key) if key.is_a? String Kernel.warn("Postmark: the CamelCased String keys of response are " \ "deprecated in favor of underscored symbols. The " \ "support will be dropped in the future.") end super end end end end
Version data entries
43 entries across 43 versions & 1 rubygems
Version | Path |
---|---|
postmark-1.0.2 | lib/postmark/helpers/hash_helper.rb |
postmark-1.0.1 | lib/postmark/helpers/hash_helper.rb |
postmark-1.0.0 | lib/postmark/helpers/hash_helper.rb |