adamh-hpricot 0.6.210 → 0.6.211

Sign up to get free protection for your applications and to get access to all the features.
@@ -153,6 +153,19 @@ void rb_yield_tokens(VALUE sym, VALUE tag, VALUE attr, VALUE raw, int taint)
153
153
  rb_yield(ary);
154
154
  }
155
155
 
156
+ /* rb_hash_lookup() is only in Ruby 1.8.7 */
157
+ static VALUE
158
+ our_rb_hash_lookup(VALUE hash, VALUE key)
159
+ {
160
+ VALUE val;
161
+
162
+ if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
163
+ return Qnil; /* without Hash#default */
164
+ }
165
+
166
+ return val;
167
+ }
168
+
156
169
  static void
157
170
  rb_hpricot_add(VALUE focus, VALUE ele)
158
171
  {
@@ -321,7 +334,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
321
334
 
322
335
  if (TYPE(hee->EC) == T_HASH)
323
336
  {
324
- VALUE has = rb_hash_lookup(hee->EC, INT2NUM(he->name));
337
+ VALUE has = our_rb_hash_lookup(hee->EC, INT2NUM(he->name));
325
338
  if (has != Qnil) {
326
339
  if (has == Qtrue) {
327
340
  if (match == Qnil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adamh-hpricot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.210
4
+ version: 0.6.211
5
5
  platform: ruby
6
6
  authors:
7
7
  - why the lucky stiff