Module: Jinx::Math
- Defined in:
- lib/jinx/helpers/math.rb
Class Method Summary collapse
-
.max(*args) ⇒ Numeric
The largest number.
-
.min(*args) ⇒ Numeric
The smallest number.
-
.numeric?(value) ⇒ Boolean
Whether the value is a Ruby or Java number.
Class Method Details
.max(*args) ⇒ Numeric
Returns the largest number.
11 12 13 |
# File 'lib/jinx/helpers/math.rb', line 11 def self.max(*args) args.inject { |m, n| m < n ? n : m } end |
.min(*args) ⇒ Numeric
Returns the smallest number.
5 6 7 |
# File 'lib/jinx/helpers/math.rb', line 5 def self.min(*args) args.inject { |m, n| m < n ? m : n } end |