From d75525b045b9f27ed108912a6dbdbad5ab775045 Mon Sep 17 00:00:00 2001 From: Sean Ouimet Date: Mon, 5 May 2008 10:03:11 -0500 Subject: Added OrderedHash#delete [#113 state:resolved] Signed-off-by: Joshua Peek --- activesupport/lib/active_support/ordered_options.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb index b2b1b0e438..3172f62f0d 100644 --- a/activesupport/lib/active_support/ordered_options.rb +++ b/activesupport/lib/active_support/ordered_options.rb @@ -18,6 +18,12 @@ module ActiveSupport pair = assoc(key) pair ? pair.last : nil end + + def delete(key) + pair = assoc(key) + pair ? array_index = index(pair) : nil + array_index ? delete_at(array_index).last : nil + end def keys collect { |key, value| key } -- cgit v1.2.3