Module: Alchemist

Defined in:
lib/alchemist.rb,
lib/alchemist/library.rb,
lib/alchemist/version.rb,
lib/alchemist/geospatial.rb,
lib/alchemist/measurement.rb,
lib/alchemist/configuration.rb,
lib/alchemist/prefix_parser.rb,
lib/alchemist/module_builder.rb,
lib/alchemist/conversion_table.rb,
lib/alchemist/compound_measurement.rb,
lib/alchemist/measurement_convertor.rb,
lib/alchemist/objects/planets/earth.rb

Defined Under Namespace

Classes: CompoundMeasurement, Configuration, ConversionTable, Earth, Library, Measurement, MeasurementConvertor, ModuleBuilder, PrefixParser

Constant Summary collapse

VERSION =
"0.1.7"

Class Method Summary collapse

Class Method Details

.configObject


4
5
6
# File 'lib/alchemist/configuration.rb', line 4

def self.config
  Configuration.instance
end

.libraryObject


4
5
6
# File 'lib/alchemist/library.rb', line 4

def self.library
  Library.instance
end

.measure(value, unit, exponent = 1.0) ⇒ Object


19
20
21
# File 'lib/alchemist.rb', line 19

def self.measure value, unit, exponent = 1.0
  Measurement.new value, unit, exponent
end

.setup(category = nil) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/alchemist.rb', line 11

def self.setup category = nil
  if category
    Numeric.send(:include, ModuleBuilder.new(category).build)
  else
    library.categories.each { |category| Numeric.send(:include, ModuleBuilder.new(category).build) }
  end
end