Module: Trith::Core::Comparison
- Defined in:
- lib/trith/core/comparison.rb
Overview
Comparison operators.
Instance Method Summary (collapse)
- - (Integer) cmp(a, b) (also: #<=>)
- - (Boolean) eq(a, b)
- - (Boolean) ge(a, b) (also: #>=)
- - (Boolean) gt(a, b) (also: #>)
- - (Boolean) le(a, b) (also: #<=)
- - (Boolean) lt(a, b) (also: #<)
- - (Object) max(a, b)
- - (Object) min(a, b)
- - (Boolean) ne(a, b)
Instance Method Details
- (Integer) cmp(a, b) Also known as: <=>
13 14 15 |
# File 'lib/trith/core/comparison.rb', line 13 def cmp(a, b) a <=> b end |
- (Boolean) eq(a, b)
22 23 24 |
# File 'lib/trith/core/comparison.rb', line 22 def eq(a, b) a == b end |
- (Boolean) ge(a, b) Also known as: >=
67 68 69 |
# File 'lib/trith/core/comparison.rb', line 67 def ge(a, b) a >= b end |
- (Boolean) gt(a, b) Also known as: >
58 59 60 |
# File 'lib/trith/core/comparison.rb', line 58 def gt(a, b) a > b end |
- (Boolean) le(a, b) Also known as: <=
49 50 51 |
# File 'lib/trith/core/comparison.rb', line 49 def le(a, b) a <= b end |
- (Boolean) lt(a, b) Also known as: <
40 41 42 |
# File 'lib/trith/core/comparison.rb', line 40 def lt(a, b) a < b end |
- (Object) max(a, b)
84 85 86 |
# File 'lib/trith/core/comparison.rb', line 84 def max(a, b) [a, b].max end |
- (Object) min(a, b)
76 77 78 |
# File 'lib/trith/core/comparison.rb', line 76 def min(a, b) [a, b].min end |
- (Boolean) ne(a, b)
31 32 33 |
# File 'lib/trith/core/comparison.rb', line 31 def ne(a, b) a != b end |