I tried to figure out how to create ranges from custom objects in Ruby. I am very new to Ruby, and I found the Range documentation not useful.
The error I received while trying to create a range from my objects was simply "Bad value for the range."
In the end, I realized that in order to create a range from my object, I had to define the functions "succ" and "<=>".
My question is that. Is there a good resource that would tell me that I need to define the above 2 functions in order to use my object in a range? I would like to avoid such problems in the future.
Sorry for the unconventional question. Thank you for your time.
source share