Module: Unitwise::Standard

Defined in:
lib/unitwise/standard.rb,
lib/unitwise/standard/base.rb,
lib/unitwise/standard/scale.rb,
lib/unitwise/standard/extras.rb,
lib/unitwise/standard/prefix.rb,
lib/unitwise/standard/function.rb,
lib/unitwise/standard/base_unit.rb,
lib/unitwise/standard/derived_unit.rb

Overview

The Standard module is responsible for fetching the UCUM specification unit standards and translating them into yaml files. This code is only used for by the rake task ‘rake unitwise:update_standard` and as such is not normally loaded.

Defined Under Namespace

Modules: Extras Classes: Base, BaseUnit, DerivedUnit, Function, Prefix, Scale

Constant Summary collapse

HOST =
"unitsofmeasure.org"
PATH =
"/ucum-essence.xml"

Class Method Summary collapse

Class Method Details

.bodyObject



20
21
22
# File 'lib/unitwise/standard.rb', line 20

def body
  @body ||= Net::HTTP.get HOST, PATH
end

.hashObject



24
25
26
# File 'lib/unitwise/standard.rb', line 24

def hash
  Nori.new.parse(body)["root"]
end