Class: Van::Units::BinaryLoader

Inherits:
Loader
  • Object
show all
Defined in:
lib/van/units/units.rb

Constant Summary collapse

BINARY_PREFIXES =

The prefixes used for binary units. See also Converter#register_binary_unit.

{
  'yotta' => {:abbrev => 'Y', :multiplier => 1024.0 ** 8},
  'zetta' => {:abbrev => 'Z', :multiplier => 1024.0 ** 7},
  'exa'   => {:abbrev => 'E', :multiplier => 1024.0 ** 6},
  'peta'  => {:abbrev => 'P', :multiplier => 1024.0 ** 5},
  'tera'  => {:abbrev => 'T', :multiplier => 1024.0 ** 4},
  'giga'  => {:abbrev => 'G', :multiplier => 1024.0 ** 3},
  'mega'  => {:abbrev => 'M', :multiplier => 1024.0 ** 2},
  'kilo'  => {:abbrev => 'k', :multiplier => 1024.0},
}

Instance Method Summary collapse

Methods inherited from Loader

handles, method_added

Instance Method Details

#binary_unit(converter, name, *args) ⇒ Object



72
73
74
# File 'lib/van/units/units.rb', line 72

def binary_unit(converter, name, *args)
  converter.send(:register_prefixed_unit, name, BINARY_PREFIXES, *args)
end