Class: Uom

Inherits:
Object
  • Object
show all
Defined in:
lib/uom.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Uom

Returns a new instance of Uom.



6
7
8
9
10
11
# File 'lib/uom.rb', line 6

def initialize(path=nil)
  if !path then
    path = Uom::default_uom_file
  end
  @uom_map = load_uom_map path
end

Class Method Details

.default_uom_fileObject



17
18
19
# File 'lib/uom.rb', line 17

def self.default_uom_file
  File.expand_path(File.dirname(__FILE__) + "/uom.json")
end

Instance Method Details

#translate(in_uom) ⇒ Object



13
14
15
# File 'lib/uom.rb', line 13

def translate (in_uom)
  @uom_map[in_uom.downcase]
end