vendor/rails/activesupport/lib/active_support/ordered_hash.rb in radiant-0.9.1 vs vendor/rails/activesupport/lib/active_support/ordered_hash.rb in radiant-1.0.0.rc1

- old
+ new

@@ -132,18 +132,24 @@ def merge!(other_hash) other_hash.each {|k,v| self[k] = v } self end + alias_method :update, :merge! + def merge(other_hash) dup.merge!(other_hash) end # When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not. def replace(other) super @keys = other.keys self + end + + def invert + OrderedHash[self.to_a.map!{|key_value_pair| key_value_pair.reverse}] end def inspect "#<OrderedHash #{super}>" end