Class: Lite::Containers::Helpers::Comparison::Max
- Inherits:
-
Abstract
- Object
- Abstract
- Lite::Containers::Helpers::Comparison::Max
show all
- Defined in:
- lib/lite/containers/helpers/comparison.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Abstract
#compare, #for_item, for_item, #for_key, #initialize, #to_key, to_key
Class Method Details
.compare(a, b) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/lite/containers/helpers/comparison.rb', line 68
def compare(a, b)
result = a <=> b
raise Error, "No meaningful comparison between #{a} <=> #{b}" if result.nil?
result
end
|
.instance(key_extractor) ⇒ Object
64
65
66
|
# File 'lib/lite/containers/helpers/comparison.rb', line 64
def instance()
? new() : self
end
|
.invert ⇒ Object
75
76
77
|
# File 'lib/lite/containers/helpers/comparison.rb', line 75
def invert
Min
end
|
Instance Method Details
#invert ⇒ Object
59
60
61
|
# File 'lib/lite/containers/helpers/comparison.rb', line 59
def invert
Comparison.instance :min, key_extractor: @key_extractor
end
|