module Scale::Destination
These are the classes that describe what range the transformed number will wind up in. They're named after the core Ruby class that the input closest resembles.
Constants
- MAP
Map Ruby classes/modules to scaling destination classes/modules
Public Class Methods
new(destination)
click to toggle source
Build the appropriate scaling destination class for the given Ruby object @param [::Enumerable] destination @return [Scale::Destination::Enumerable, Scale::Destination::Range]
# File lib/scale/destination.rb, line 62 def self.new(destination) klass = MAP[destination.class] if klass.nil? klasses = MAP.select { |k,v| destination.kind_of?(k) } klass = klasses.values.first end klass.new(destination) unless klass.nil? end