I have not found any description for the operators >, <, >=, <= in the documentation for Object and Class.
String > Object # => false
BasicObject > Object # => true
String > Integer # => nil
When class level comparison is done, it looks for hierarchy/relationship.
String > Object returns false because Object is ancestor for String class.
Similar will be followed for this hierarchy Object -> Numeric -> Integer
String > Integer returns nil because both classes do not come in same hierarchy/relationship.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With