First-time poster… I apologize if I am posting to the wrong group.
I am teaching a class of high-schoolers in programming, using Ruby. I
gave them an exercise called “Stupid String Tricks” which was about
getting them comfortable using the online documentation for Ruby. The
assignment was to do five silly things with Strings and share their
results with the class.
While walking through the docs online during class, we decided to dig
into <=> and demonstrate how it works and how to interpret the docs.
We used this page:
I thought that page was the authoritative one.
I believe the operator/method behaves correctly, but believe the doc
is not correct.
str <=> other_str => -1, 0, +1
Comparison—Returns -1 if other_str is less than, 0 if other_str is
equal to, and +1 if other_str is greater than str.
Isn’t it the other way around? Shouldn’t the return be -1 if str is
less than other_str? The class behavior and the examples in the docs
all behave that way.
If this is not the right place to get visibility for this, what is?
Thanks in advance.