Class: OAI::Set
Overview
bundles up information about a set retrieved during a ListSets request
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#spec ⇒ Object
Returns the value of attribute spec.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(values = {}) ⇒ Set
constructor
A new instance of Set.
- #to_s ⇒ Object
Methods included from XPath
#get_attribute, #xpath, #xpath_all, #xpath_first
Constructor Details
#initialize(values = {}) ⇒ Set
Returns a new instance of Set.
10 11 12 13 14 15 |
# File 'lib/oai/set.rb', line 10 def initialize(values = {}) @name = values.delete(:name) @spec = values.delete(:spec) @description = values.delete(:description) raise ArgumentException, "Invalid options" unless values.empty? end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/oai/set.rb', line 8 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/oai/set.rb', line 8 def name @name end |
#spec ⇒ Object
Returns the value of attribute spec.
8 9 10 |
# File 'lib/oai/set.rb', line 8 def spec @spec end |
Class Method Details
.parse(element) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/oai/set.rb', line 17 def self.parse(element) set = self.new set.name = set.xpath(element, './/setName') set.spec = set.xpath(element, './/setSpec') set.description = set.xpath_first(element, './/setDescription') set end |
Instance Method Details
#to_s ⇒ Object
25 26 27 |
# File 'lib/oai/set.rb', line 25 def to_s "#{@name} [#{@spec}]" end |