module Ole::Types::Variant

The OLE variant types, extracted from www.marin.clara.net/COM/variant_type_definitions.htm.

A subset is also in WIN32OLE::VARIANT, but its not cross platform (obviously).

Use like:

p Ole::Types::Variant::NAMES[0x001f] => 'VT_LPWSTR'
p Ole::Types::VT_DATE # => 7

The serialization / deserialization functions should be fixed to make it easier to work with. like

Ole::Types.from_str(VT_DATE, data) # and
Ole::Types.to_str(VT_DATE, data)

Or similar, rather than having to do VT_* <=> ad hoc class name etc as it is currently.

Constants

CLASS_MAP
NAMES

Public Class Methods

dump(type, variant) click to toggle source
# File lib/ole/types/base.rb, line 261
def self.dump type, variant
  type = NAMES[type] or raise ArgumentError, 'unknown ole type - 0x%04x' % type
  (CLASS_MAP[type] || Data).dump variant
end
load(type, str) click to toggle source
# File lib/ole/types/base.rb, line 256
def self.load type, str
  type = NAMES[type] or raise ArgumentError, 'unknown ole type - 0x%04x' % type
  (CLASS_MAP[type] || Data).load str
end