Sha256: c873fa785e683696bef378b10c46dae342323352c77b33bada3c129d331843f7
Contents?: true
Size: 692 Bytes
Versions: 1
Compression:
Stored size: 692 Bytes
Contents
module Quebert module Support # Borrowed from Rails ActiveSupport def self.constantize(camel_cased_word) #:nodoc: names = camel_cased_word.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) end constant end def self.symbolize_keys(hash) map_keys(hash, :to_sym) end def self.stringify_keys(hash) map_keys(hash, :to_s) end private def self.map_keys(hash, meth) hash.inject({}){|h, (k,v)| h[k.send(meth)] = v; h; } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quebert-0.0.0 | lib/quebert/support.rb |