mruby-range-ext/range.c: `cover?` should work with begin-less ranges.

parent 4e8ab145
...@@ -40,7 +40,7 @@ range_cover(mrb_state *mrb, mrb_value range) ...@@ -40,7 +40,7 @@ range_cover(mrb_state *mrb, mrb_value range)
beg = RANGE_BEG(r); beg = RANGE_BEG(r);
end = RANGE_END(r); end = RANGE_END(r);
if (r_le(mrb, beg, val)) { if (mrb_nil_p(beg) || r_le(mrb, beg, val)) {
if (mrb_nil_p(end)) { if (mrb_nil_p(end)) {
return mrb_true_value(); return mrb_true_value();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment