diff options
author | Sean Ouimet <sean@seanouimet.com> | 2008-05-05 10:03:11 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-05-05 10:03:11 -0500 |
commit | d75525b045b9f27ed108912a6dbdbad5ab775045 (patch) | |
tree | ed768c14c9df5e0ac0b1a2c99699c9cd6d777ef0 /activesupport/lib/active_support | |
parent | a40223d36d4e90d520b09d51a3f2a7b3cd6c2f07 (diff) | |
download | rails-d75525b045b9f27ed108912a6dbdbad5ab775045.tar.gz rails-d75525b045b9f27ed108912a6dbdbad5ab775045.tar.bz2 rails-d75525b045b9f27ed108912a6dbdbad5ab775045.zip |
Added OrderedHash#delete [#113 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/ordered_options.rb | 6 |
1 files changed, 6 insertions, 0 deletions
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 } |