Class: Uom
- Inherits:
-
Object
- Object
- Uom
- Defined in:
- lib/uom.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ Uom
constructor
A new instance of Uom.
- #translate(in_uom) ⇒ Object
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_file ⇒ Object
17 18 19 |
# File 'lib/uom.rb', line 17 def self.default_uom_file File.(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 |