Class: DarwinCore::Metadata
- Inherits:
-
Object
- Object
- DarwinCore::Metadata
- Defined in:
- lib/dwc_archive/metadata.rb
Overview
Represents data from EML (Ecological Metadata Language) file
Instance Attribute Summary collapse
-
#metadata ⇒ Object
(also: #data)
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #abstract ⇒ Object
- #authors ⇒ Object
- #citation ⇒ Object
- #id ⇒ Object
-
#initialize(archive = nil) ⇒ Metadata
constructor
A new instance of Metadata.
- #package_id ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(archive = nil) ⇒ Metadata
Returns a new instance of Metadata.
9 10 11 12 |
# File 'lib/dwc_archive/metadata.rb', line 9 def initialize(archive = nil) @archive = archive @metadata = @archive.eml end |
Instance Attribute Details
#metadata ⇒ Object (readonly) Also known as: data
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/dwc_archive/metadata.rb', line 6 def @metadata end |
Instance Method Details
#abstract ⇒ Object
37 38 39 |
# File 'lib/dwc_archive/metadata.rb', line 37 def abstract fix_nil { @metadata[:eml][:dataset][:abstract] } end |
#authors ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dwc_archive/metadata.rb', line 26 def return nil unless defined?(@metadata[:eml][:dataset][:creator]) = [@metadata[:eml][:dataset][:creator]].flatten .map do |au| { first_name: au[:individualName][:givenName], last_name: au[:individualName][:surName], email: au[:electronicMailAddress] } end end |
#citation ⇒ Object
41 42 43 |
# File 'lib/dwc_archive/metadata.rb', line 41 def citation fix_nil { @metadata[:eml][:additionalMetadata][:metadata][:citation] } end |
#id ⇒ Object
14 15 16 |
# File 'lib/dwc_archive/metadata.rb', line 14 def id fix_nil { @metadata[:eml][:dataset][:attributes][:id] } end |
#package_id ⇒ Object
18 19 20 |
# File 'lib/dwc_archive/metadata.rb', line 18 def package_id fix_nil { @metadata.data[:eml][:attributes][:packageId] } end |
#title ⇒ Object
22 23 24 |
# File 'lib/dwc_archive/metadata.rb', line 22 def title fix_nil { @metadata[:eml][:dataset][:title] } end |
#url ⇒ Object
45 46 47 |
# File 'lib/dwc_archive/metadata.rb', line 45 def url fix_nil { @metadata[:eml][:dataset][:distribution][:online][:url] } end |