Sha256: 3085938b8607a90c6501833c7153d6668ac9e37c347252f39c91373b79876487

Contents?: true

Size: 695 Bytes

Versions: 5

Compression:

Stored size: 695 Bytes

Contents

class DarwinCore
  class Core
    def initialize(archive)
      @archive = archive
      @path = @archive.files_path
      root_key = @archive.meta.keys[0]
      @core = @archive.meta[root_key][:core]
      raise "Cannot found core in meta.xml, is meta.xml valid?" unless @core
    end

    def data
      @core
    end

    def properties
      @core[:attributes]
    end

    def file_path
      file = @core[:files][:location] || @core[:location]
      File.join(@path, file)
    end

    def id
      @core[:id][:attributes]
    end

    def fields
      @core[:field] = [@core[:field]] unless @core[:field].class == Array
      @core[:field].map {|f| f[:attributes]}
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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