Module: MinMaxComparison

Included in:
Fixnum, Float, Rational
Defined in:
lib/wdd-ruby-ext/numbers.rb

Instance Method Summary collapse

Instance Method Details

#max(value) ⇒ Object

Returns the greater of the object’s value or value



4
5
6
7
8
9
10
# File 'lib/wdd-ruby-ext/numbers.rb', line 4

def max( value )
  if value > self
    value
  else
    self
  end
end

#min(value) ⇒ Object

Returns the lesser of the object’s value or value



13
14
15
16
17
18
19
# File 'lib/wdd-ruby-ext/numbers.rb', line 13

def min( value )
  if value < self
    value
  else
    self
  end
end