Module: Units::ClassMethods

Defined in:
lib/units/base.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#add_unit_aliases(hash = {}) ⇒ Object



67
# File 'lib/units/base.rb', line 67

def add_unit_aliases(hash={})     unit_aliases.update(hash)     end

#add_unit_conversions(hash = {}) ⇒ Object



66
# File 'lib/units/base.rb', line 66

def add_unit_conversions(hash={}) unit_conversions.update(hash) end

#all_unit_aliases(kind) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/units/base.rb', line 74

def all_unit_aliases(kind)
  results = Array.new
  results += @@unit_conversions[kind].keys rescue nil
  results += @@unit_aliases[kind].to_a.flatten rescue nil

  return results.uniq
end

#init_unitsObject



69
70
71
72
# File 'lib/units/base.rb', line 69

def init_units
  @@unit_conversions = Hash.new
  @@unit_aliases = Hash.new
end

#unit_aliasesObject



65
# File 'lib/units/base.rb', line 65

def unit_aliases()                @@unit_aliases                end

#unit_conversionsObject



64
# File 'lib/units/base.rb', line 64

def unit_conversions()            @@unit_conversions            end