I just wanted to show you this. Is this the C source for the between? method between? :
static VALUE cmp_between(VALUE x, VALUE min, VALUE max) { if (RTEST(cmp_lt(x, min))) return Qfalse; if (RTEST(cmp_gt(x, max))) return Qfalse; return Qtrue; }
Until I reviewed each version, I believe that this method has not changed since Ruby 1.8.7.
cmp_lt and cmp_gt in plain English: "compare less" and "compare more".
So, as you can see, the method will return false if the value of x , which in your case is your length a length 144, is less than min , which will be b length 544. Since 144 <544, you get the correct answer, and it seems that the book contains an error.
It seems that I can’t determine if this error has ever been before, so if you are prone, it may be useful to contact the author and let him know.
source share