The spaceship operator is general comparison operator. The <=> operator compares 2 values and returning -1, 0, or 1 depending on whether the first value is less than, equal, or greater than the second.
Example in irb.
This operator is used on ruby range operation , objects must implement <=> and succ method to perform range operation. Lets test the a numeric value for these methods.
Keep learning ruby on 2021.