Class: CommonCartridge::Parsers::Dependencies

Inherits:
Object
  • Object
show all
Defined in:
lib/common_cartridge/parsers/dependencies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zipfile, resource) ⇒ Dependencies

Returns a new instance of Dependencies.



6
7
8
9
# File 'lib/common_cartridge/parsers/dependencies.rb', line 6

def initialize(zipfile, resource)
  @zipfile = zipfile
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/common_cartridge/parsers/dependencies.rb', line 4

def resource
  @resource
end

Instance Method Details

#parse!(package) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/common_cartridge/parsers/dependencies.rb', line 11

def parse!(package)
  resource.dependencies.each do |d|
    resource = package.find_resource(d.identifierref)
    resource.files.each do |f|
      Parser.use_file(@zipfile, f.href) do |xml|
        d.contents << CommonCartridge::Elements::Resources::Content.parse(xml)
      end
    end
  end
end