Module: Sorting::Bigger

Extended by:
Comparable
Defined in:
lib/sorting/bigger.rb

Overview

Note:

require 'sorting' loads this module

A value whose #<=> method will always compare as being the bigger value. Useful for defaultizing potentially nil values before comparing/sorting.

Examples:

age = person.age || Sorting::Bigger

See Also:

Class Method Summary collapse

Class Method Details

.<=>(other) ⇒ 1

Returns Comparison. Pretends this object is bigger and hence always returns 1

Returns:

  • (1)

    Comparison. Pretends this object is bigger and hence always returns 1


24
25
26
# File 'lib/sorting/bigger.rb', line 24

def self.<=>(other)
  1
end