class Numeric

Public Instance Methods

clamp(min, max) click to toggle source
# File lib/rgw/types.rb, line 47
def clamp min, max
    s = self.max(min)
    s.min(max)
end
in(a, b) click to toggle source
# File lib/rgw/types.rb, line 42
def in a, b
    a.min(b) < self && self < a.max(b)
end
max(a) click to toggle source
# File lib/rgw/types.rb, line 37
def max a
    self >= a ? self : a
end
min(a) click to toggle source
# File lib/rgw/types.rb, line 32
def min a
    self <= a ? self : a
end