lib/celsius/hash.rb in celsius-0.4.0 vs lib/celsius/hash.rb in celsius-0.4.1

- old
+ new

@@ -29,6 +29,20 @@ # in case nothing was found, return nil to ease detecting this case results.empty? ? nil : results end end + + def self.smart_store(hash, key, value) + if hash[key] + unless hash[key].is_a?(Array) + hash[key] = [hash[key]] + end + + hash[key].push(value) + else + hash[key] = value + end + + hash + end end