Snippet: Range#compare
Here's a little idea that popped into my head for enhancing the Range class in Ruby:
Then you can perform broad comparisons, like so:
Example:
>> try_compare( 3 ) "3 is inside the range 1..10" >> try_compare( -1 ) "-1 is below the range 1..10" >> try_compare( 11 ) "11 is above the range 1..10"
I haven't decided whether this is useful, or just daft.