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.
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
#element ⇒ Object (readonly)
Returns the value of attribute element.
10 11 12 |
# File 'lib/fieldhand/metadata_format.rb', line 10 def element @element end |
#response_date ⇒ Object (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
#namespace ⇒ Object
Return the XML Namespace URI for the format.
38 39 40 |
# File 'lib/fieldhand/metadata_format.rb', line 38 def namespace @namespace ||= URI(element..text) end |
#prefix ⇒ Object
Return the string metadata prefix for the format.
28 29 30 |
# File 'lib/fieldhand/metadata_format.rb', line 28 def prefix @prefix ||= element..text end |
#schema ⇒ Object
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_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.
23 24 25 |
# File 'lib/fieldhand/metadata_format.rb', line 23 def to_s prefix end |