@@ -96,6 +96,11 @@ VALUE hash_spec_rb_hash_lookup2(VALUE self, VALUE hash, VALUE key, VALUE def) {
96
96
return rb_hash_lookup2 (hash , key , def );
97
97
}
98
98
99
+ VALUE hash_spec_rb_hash_lookup2_default_undef (VALUE self , VALUE hash , VALUE key ) {
100
+ VALUE ret = rb_hash_lookup2 (hash , key , Qundef );
101
+ return ret == Qundef ? Qtrue : Qfalse ;
102
+ }
103
+
99
104
VALUE hash_spec_rb_hash_new (VALUE self ) {
100
105
return rb_hash_new ();
101
106
}
@@ -127,6 +132,7 @@ void Init_hash_spec(void) {
127
132
rb_define_method (cls , "rb_hash_lookup_nil" , hash_spec_rb_hash_lookup_nil , 2 );
128
133
rb_define_method (cls , "rb_hash_lookup" , hash_spec_rb_hash_lookup , 2 );
129
134
rb_define_method (cls , "rb_hash_lookup2" , hash_spec_rb_hash_lookup2 , 3 );
135
+ rb_define_method (cls , "rb_hash_lookup2_default_undef" , hash_spec_rb_hash_lookup2_default_undef , 2 );
130
136
rb_define_method (cls , "rb_hash_new" , hash_spec_rb_hash_new , 0 );
131
137
rb_define_method (cls , "rb_hash_size" , hash_spec_rb_hash_size , 1 );
132
138
rb_define_method (cls , "rb_hash_set_ifnone" , hash_spec_rb_hash_set_ifnone , 2 );
0 commit comments