Class: Fieldhand::MetadataFormat
- Inherits:
-
Object
- Object
- Fieldhand::MetadataFormat
- 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
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#response_date ⇒ Object
readonly
Returns the value of attribute response_date.
Instance Method Summary collapse
-
#initialize(element, response_date = Time.now) ⇒ MetadataFormat
constructor
Return a new Metadata Format for the given element with an optional response date.
-
#namespace ⇒ Object
Return the XML Namespace URI for the format.
-
#prefix ⇒ Object
Return the string metadata prefix for the format.
-
#schema ⇒ Object
Return the location of an XML Schema describing the format as a URI.
-
#to_s ⇒ Object
Return the prefix as a string representation of the format.
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.
13 14 15 16 |
# File 'lib/fieldhand/metadata_format.rb', line 13 def initialize(element, response_date = Time.now) @element = element @response_date = response_date end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
8 9 10 |
# File 'lib/fieldhand/metadata_format.rb', line 8 def element @element end |
#response_date ⇒ Object (readonly)
Returns the value of attribute response_date.
8 9 10 |
# File 'lib/fieldhand/metadata_format.rb', line 8 def response_date @response_date end |
Instance Method Details
#namespace ⇒ Object
Return the XML Namespace URI for the format.
36 37 38 |
# File 'lib/fieldhand/metadata_format.rb', line 36 def namespace @namespace ||= URI(element..text) end |
#prefix ⇒ Object
Return the string metadata prefix for the format.
26 27 28 |
# File 'lib/fieldhand/metadata_format.rb', line 26 def prefix @prefix ||= element..text end |
#schema ⇒ Object
Return the location of an XML Schema describing the format as a URI.
31 32 33 |
# File 'lib/fieldhand/metadata_format.rb', line 31 def schema @schema ||= URI(element.schema.text) end |
#to_s ⇒ Object
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.
21 22 23 |
# File 'lib/fieldhand/metadata_format.rb', line 21 def to_s prefix end |