Class: Lite::Containers::Helpers::Comparison::Min
- Inherits:
-
Abstract
- Object
- Abstract
- Lite::Containers::Helpers::Comparison::Min
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
91
92
93
94
95
96
|
# File 'lib/lite/containers/helpers/comparison.rb', line 91
def compare(a, b)
result = b <=> a
raise Error, "No meaningful comparison between #{a} <=> #{b}" if result.nil?
result
end
|
.instance(key_extractor) ⇒ Object
87
88
89
|
# File 'lib/lite/containers/helpers/comparison.rb', line 87
def instance()
? new() : self
end
|
.invert ⇒ Object
98
99
100
|
# File 'lib/lite/containers/helpers/comparison.rb', line 98
def invert
Max
end
|
Instance Method Details
#invert ⇒ Object
82
83
84
|
# File 'lib/lite/containers/helpers/comparison.rb', line 82
def invert
Comparison.instance :max, key_extractor: @key_extractor
end
|