Class: DarwinCore::Archive

Inherits:
Object
  • Object
show all
Defined in:
lib/dwc_archive/archive.rb

Overview

Deals with handling DarwinCoreArchive file, and provides meta information and files information about archive

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(archive_path, tmp_dir) ⇒ Archive

Returns a new instance of Archive.



9
10
11
12
13
14
15
# File 'lib/dwc_archive/archive.rb', line 9

def initialize(archive_path, tmp_dir)
  @archive_path = archive_path
  @tmp_dir = tmp_dir
  @expander = DarwinCore::Expander.new(@archive_path, @tmp_dir)
  @expander.unpack
  
end

Instance Attribute Details

#emlObject (readonly)

Returns the value of attribute eml.



7
8
9
# File 'lib/dwc_archive/archive.rb', line 7

def eml
  @eml
end

#metaObject (readonly)

Returns the value of attribute meta.



7
8
9
# File 'lib/dwc_archive/archive.rb', line 7

def meta
  @meta
end

Instance Method Details

#cleanObject



31
32
33
# File 'lib/dwc_archive/archive.rb', line 31

def clean
  @expander.clean
end

#filesObject



23
24
25
# File 'lib/dwc_archive/archive.rb', line 23

def files
  @expander.files
end

#files_pathObject



27
28
29
# File 'lib/dwc_archive/archive.rb', line 27

def files_path
  @expander.path
end

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/dwc_archive/archive.rb', line 17

def valid?
  valid = true
  valid = valid && @expander.path && FileTest.exists?(@expander.path)
  valid && files && files.include?("meta.xml")
end