Method: PSD::Descriptor#parse
- Defined in:
- lib/psd/descriptor.rb
#parse ⇒ Object
Parse the descriptor. Descriptors always start with a class identifier, followed by a variable number of items in the descriptor. We return the Hash that represents the full data structure.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/psd/descriptor.rb', line 15 def parse PSD.logger.debug "Descriptor: pos = #{@file.tell}" @data[:class] = parse_class num_items = @file.read_int PSD.logger.debug "Class = #{@data[:class]}, Item count = #{num_items}" num_items.times do |i| id, value = parse_key_item @data[id] = value end @data end |