lib/celsius/hash.rb in celsius-0.4.1 vs lib/celsius/hash.rb in celsius-0.4.2
- old
+ new
@@ -30,9 +30,14 @@
# in case nothing was found, return nil to ease detecting this case
results.empty? ? nil : results
end
end
+ def self.smart_fetch(hash, key)
+ result = hash[key.to_s]
+ result = hash[key.to_sym] if result.nil?
+ end
+
def self.smart_store(hash, key, value)
if hash[key]
unless hash[key].is_a?(Array)
hash[key] = [hash[key]]
end