Method: PSD::Resources#parse

Defined in:
lib/psd/resources.rb

#parseObject

Parses each Resource and stores them.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/psd/resources.rb', line 19

def parse
  finish = length + @file.tell

  while @file.tell < finish
    resource = Resource.new(@file)
    resource.parse

    resource_end = @file.tell + resource.size

    name = Resource::Section.factory(@file, resource)
    @resources[resource.id] = resource
    @type_index[name] = resource.id unless name.nil?

    @file.seek resource_end
  end

  @file.seek finish if @file.tell != finish
end