Sha256: cd6706533357a894cfc94e287ed518f88c829e069f283820dfde06b7c5278153

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

# encoding: UTF-8
$:.unshift(File.dirname(__FILE__)) unless
   $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))   
require 'ruby_extensions'
require 'dwc-archive/expander'
require 'dwc-archive/archive'
require 'dwc-archive/core'
require 'dwc-archive/extension'
require 'dwc-archive/metadata'

class DarwinCore
  attr_reader :archive, :core, :metadata, :extensions
  alias :eml :metadata
  def initialize(dwc_path, tmp_dir = "/tmp")
    @archive = DarwinCore::Archive.new(dwc_path, tmp_dir) 
    @core = DarwinCore::Core.new(@archive)
    @metadata = DarwinCore::Metadata.new(@archive)
    @extensions = get_extensions
  end
  private
  def get_extensions
    res = []
    root_key = @archive.meta.keys[0]
    ext = @archive.meta[root_key][:extension]
    return [] unless ext
    ext = [ext] unless ext.class == Array
    ext.map {|e| DarwinCore::Extension.new(@archive, e)}
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dwc-archive-0.1.4 lib/dwc-archive.rb
dwc-archive-0.1.3 lib/dwc-archive.rb
dwc-archive-0.1.2 lib/dwc-archive.rb