aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index a19d6c3532..6b563b9063 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -162,6 +162,10 @@ module ActiveSupport
self
end
+ def invert
+ OrderedHash[self.to_a.map!{|key_value_pair| key_value_pair.reverse}]
+ end
+
def inspect
"#<OrderedHash #{super}>"
end