Class: Range

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-processing/helpers/range.rb

Overview

Extend Range class to include clip (used to implement processing constrain)

Instance Method Summary collapse

Instance Method Details

#clip(n) ⇒ Object


3
4
5
6
# File 'lib/ruby-processing/helpers/range.rb', line 3

def clip(n)
  return n if cover?(n)
  (n < min) ? min : max
end