Module: Scale

Extended by:
Scale
Included in:
Scale
Defined in:
lib/scale.rb,
lib/scale/scheme.rb,
lib/scale/source.rb,
lib/scale/destination.rb

Overview

Helper for scaling numbers

Defined Under Namespace

Modules: Destination, Source Classes: Scheme

Constant Summary collapse

VERSION =
"0.4.2"

Instance Method Summary collapse

Instance Method Details

#from(source) ⇒ Scale::Scheme

Build a scaling scheme starting with the given source

Parameters:

  • source (::Enumerable)

Returns:



16
17
18
# File 'lib/scale/scheme.rb', line 16

def from(source)
  Scheme.new.from(source)
end

#to(destination) ⇒ Scale::Scheme

Build a scaling scheme starting with the given destination

Parameters:

  • destination (::Enumerable)

Returns:



23
24
25
# File 'lib/scale/scheme.rb', line 23

def to(destination)
  Scheme.new.to(destination)
end

#transform(input) ⇒ Scale::Scheme Also known as: scale

Build a scaling scheme for the given input

Parameters:

Returns:



8
9
10
# File 'lib/scale/scheme.rb', line 8

def transform(input)
  Scheme.new.scale(input)
end

#using(source, destination) ⇒ Scale::Scheme

Build a scaling scheme starting with the given source and destination

Parameters:

  • source (::Enumerable)
  • destination (::Enumerable)

Returns:



31
32
33
# File 'lib/scale/scheme.rb', line 31

def using(source, destination)
  Scheme.new.using(source, destination)
end