Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/fmod/core/extensions.rb

Overview

Extensions to Numeric.

Instance Method Summary collapse

Instance Method Details

#clamp(min, max) ⇒ Numeric

Returns the value clamped between a minimum and maximum value.

Parameters:

  • min (Numeric)

    The minimum permitted value.

  • max (Numeric)

    The maximum permitted value.

Returns:

  • (Numeric)

    the value clamped between a minimum and maximum value.



10
11
12
# File 'lib/fmod/core/extensions.rb', line 10

def clamp(min, max)
  [min, self, max].sort[1]
end