Class: OSCAccess::Analog::Input::Range

Inherits:
Object
  • Object
show all
Defined in:
lib/osc-access/translate.rb

Instance Method Summary collapse

Constructor Details

#initialize(range) ⇒ Range

Returns a new instance of Range.



24
25
26
# File 'lib/osc-access/translate.rb', line 24

def initialize(range)
  @range = range
end

Instance Method Details

#denominator ⇒ Object



32
33
34
# File 'lib/osc-access/translate.rb', line 32

def denominator
  (@range.last - @range.first).abs.to_f
end

#numerator(input) ⇒ Object



28
29
30
# File 'lib/osc-access/translate.rb', line 28

def numerator(input)
  (input - @range.first).to_f
end