Sha256: f7fb780c97c6df13a20809ec4be7f85836d98e45dc6dd1a67488033f92fd70fe
Contents?: true
Size: 877 Bytes
Versions: 33
Compression:
Stored size: 877 Bytes
Contents
require 'nokogiri' class DarwinCore class Archive attr_reader :meta, :eml def initialize(archive_path, tmp_dir) @archive_path = archive_path @tmp_dir = tmp_dir @expander = DarwinCore::Expander.new(@archive_path, @tmp_dir) @expander.unpack if valid? @meta = Hash.from_xml(open(File.join(@expander.path, 'meta.xml'))) @eml = files.include?("eml.xml") ? Hash.from_xml(open(File.join(@expander.path, 'eml.xml'))) : nil else clean raise InvalidArchiveError end end def valid? valid = true valid = valid && @expander.path && FileTest.exists?(@expander.path) valid = valid && files && files.include?('meta.xml') end def files @expander.files end def files_path @expander.path end def clean @expander.clean end end end
Version data entries
33 entries across 33 versions & 1 rubygems