Class: Fieldhand::MetadataFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/fieldhand/metadata_format.rb

Overview

A metadata format supported by the repository.

See www.openarchives.org/OAI/openarchivesprotocol.html#ListMetadataFormats

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element, response_date = Time.now) ⇒ MetadataFormat

Return a new Metadata Format for the given element with an optional response date.

The response date defaults to the current time.



15
16
17
18
# File 'lib/fieldhand/metadata_format.rb', line 15

def initialize(element, response_date = Time.now)
  @element = element
  @response_date = response_date
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



10
11
12
# File 'lib/fieldhand/metadata_format.rb', line 10

def element
  @element
end

#response_dateObject (readonly)

Returns the value of attribute response_date.



10
11
12
# File 'lib/fieldhand/metadata_format.rb', line 10

def response_date
  @response_date
end

Instance Method Details

#namespaceObject

Return the XML Namespace URI for the format.



38
39
40
# File 'lib/fieldhand/metadata_format.rb', line 38

def namespace
  @namespace ||= URI(element.metadataNamespace.text)
end

#prefixObject

Return the string metadata prefix for the format.



28
29
30
# File 'lib/fieldhand/metadata_format.rb', line 28

def prefix
  @prefix ||= element.metadataPrefix.text
end

#schemaObject

Return the location of an XML Schema describing the format as a URI.



33
34
35
# File 'lib/fieldhand/metadata_format.rb', line 33

def schema
  @schema ||= URI(element.schema.text)
end

#to_sObject

Return the prefix as a string representation of the format.

This makes it possible to pass a Metadata Format to methods that expect a string metadata prefix.



23
24
25
# File 'lib/fieldhand/metadata_format.rb', line 23

def to_s
  prefix
end