diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-06-04 11:05:46 +1200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-06-04 11:05:46 +1200 |
commit | e3c26e9926948587efcc8d31c729395093407df6 (patch) | |
tree | 358f418791a56620c32a48776739b4fdf39d3cb0 /activesupport/lib/active_support/ordered_hash.rb | |
parent | b9a9b91a3e3b892ab72ff5c618181747d6b4be04 (diff) | |
parent | 8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6 (diff) | |
download | rails-e3c26e9926948587efcc8d31c729395093407df6.tar.gz rails-e3c26e9926948587efcc8d31c729395093407df6.tar.bz2 rails-e3c26e9926948587efcc8d31c729395093407df6.zip |
Merge branch 'master' into patches
Diffstat (limited to 'activesupport/lib/active_support/ordered_hash.rb')
-rw-r--r-- | activesupport/lib/active_support/ordered_hash.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 6993621ef9..59ceaec696 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -38,6 +38,20 @@ module ActiveSupport each { |array| hash[array[0]] = array[1] } end end + + def has_key?(k) + !assoc(k).nil? + end + + alias_method :key?, :has_key? + alias_method :include?, :has_key? + alias_method :member?, :has_key? + + def has_value?(v) + any? { |key, value| value == v } + end + + alias_method :value?, :has_value? end end end |