class Ole::Types::PropertySet::Section
Constants
- PACK
- SIZE
Attributes
guid[RW]
length[R]
offset[RW]
Public Class Methods
new(str, property_set)
click to toggle source
# File lib/ole/types/property_set.rb, line 86 def initialize str, property_set @property_set = property_set @guid, @offset = str.unpack PACK self.guid = Clsid.load guid load_header end
Public Instance Methods
[](key)
click to toggle source
# File lib/ole/types/property_set.rb, line 102 def [] key each_raw do |id, property_offset| return read_property(property_offset).last if key == id end nil end
[]=(key, value)
click to toggle source
# File lib/ole/types/property_set.rb, line 109 def []= key, value raise NotImplementedError, 'section writes not yet implemented' end
each() { |id, read_property(property_offset).last| ... }
click to toggle source
# File lib/ole/types/property_set.rb, line 113 def each each_raw do |id, property_offset| yield id, read_property(property_offset).last end end
io()
click to toggle source
# File lib/ole/types/property_set.rb, line 93 def io @property_set.io end
load_header()
click to toggle source
# File lib/ole/types/property_set.rb, line 97 def load_header io.seek offset @byte_size, @length = io.read(8).unpack 'V2' end
Private Instance Methods
each_raw() { |*unpack('V2')| ... }
click to toggle source
# File lib/ole/types/property_set.rb, line 121 def each_raw io.seek offset + 8 io.read(length * 8).each_chunk(8) { |str| yield(*str.unpack('V2')) } end
read_property(property_offset)
click to toggle source
# File lib/ole/types/property_set.rb, line 126 def read_property property_offset io.seek offset + property_offset type, value = io.read(8).unpack('V2') # is the method of serialization here custom? case type when VT_LPSTR, VT_LPWSTR value = Variant.load type, io.read(value) # .... end [type, value] end