Module: Windows::Units::Converter::Formats

Included in:
Finder
Defined in:
lib/windows/units/converter.rb

Defined Under Namespace

Classes: Percent, Pixel

Constant Summary collapse

SUPPORTED_FORMATS =
{
  :percent => Percent,
  :pixel   => Pixel
}

Instance Method Summary collapse

Instance Method Details

#format_for(format, *args) ⇒ Object



42
43
44
45
46
# File 'lib/windows/units/converter.rb', line 42

def format_for(format, *args)
  klass = SUPPORTED_FORMATS[format]
  raise "I only support this formats #{supported_formats}" unless klass
  klass.new(*args)
end

#supported_formatsObject



38
39
40
# File 'lib/windows/units/converter.rb', line 38

def supported_formats
  SUPPORTED_FORMATS.keys
end