Module: Lazier::Math::ClassMethods
- Defined in:
- lib/lazier/math.rb
Overview
General methods.
Instance Method Summary (collapse)
-
- (Object) max(*args)
Returns the maximum value in the arguments.
-
- (Object) min(*args)
Returns the minimum value in the arguments.
Instance Method Details
- (Object) max(*args)
Returns the maximum value in the arguments
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lazier/math.rb', line 34 def max(*args) rv = nil args = args.ensure_array.flatten if args.length > 0 then rv = args[0] args.each do |a| rv = a if a > rv end end rv end |
- (Object) min(*args)
Returns the minimum value in the arguments
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/lazier/math.rb', line 18 def min(*args) rv = nil args = args.ensure_array.flatten if args.length > 0 then rv = args[0] args.each do |a| rv = a if a < rv end end rv end |