Class: Scale::Source::Range
- Inherits:
-
Object
- Object
- Scale::Source::Range
- Defined in:
- lib/scale/source.rb
Overview
Contains logic for dealing with Ruby’s core ::Range as input
Instance Method Summary collapse
- #denominator ⇒ Float
-
#initialize(range) ⇒ Range
constructor
A new instance of Range.
- #numerator(input) ⇒ Float
Constructor Details
#initialize(range) ⇒ Range
12 13 14 |
# File 'lib/scale/source.rb', line 12 def initialize(range) @range = range end |
Instance Method Details
#denominator ⇒ Float
23 24 25 |
# File 'lib/scale/source.rb', line 23 def denominator (@range.last - @range.first).abs.to_f end |
#numerator(input) ⇒ Float
18 19 20 |
# File 'lib/scale/source.rb', line 18 def numerator(input) (input - @range.first).to_f end |