Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/baselibmods.rb

Instance Method Summary collapse

Instance Method Details

#clamp_to(bottom, top) ⇒ Object



2
3
4
5
# File 'lib/baselibmods.rb', line 2

def clamp_to bottom, top
    top_clamped = [self, top].min
    return [bottom,top_clamped].max
end