Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
@olivierlacan
olivierlacan / Hash#contain?.patch
Last active August 29, 2015 14:00 — forked from nobu/Hash#comprized?.diff
Proposed implementation for Hash#contains? created by Nobu and slightly tweaked for semantics. Details here: http://olivierlacan.com/posts/proposal-for-a-better-ruby-hash-include/
diff --git i/hash.c w/hash.c
index 007508a..6f39e47 100644
--- i/hash.c
+++ w/hash.c
@@ -2402,6 +2402,28 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
return ary;
}
+static int
+hash_contain_i(VALUE key, VALUE value, VALUE arg)