Class: CDMBL::OAISetLookup

Inherits:
Object
  • Object
show all
Defined in:
lib/cdmbl/oai_set_lookup.rb

Overview

Takes a hash representing an OAI ListSets response and turns that into a lookup table based on the setSpec

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oai_sets: {}) ⇒ OAISetLookup

Returns a new instance of OAISetLookup.



9
10
11
# File 'lib/cdmbl/oai_set_lookup.rb', line 9

def initialize(oai_sets: {})
  @oai_sets = oai_sets
end

Instance Attribute Details

#oai_setsObject (readonly)

Returns the value of attribute oai_sets.



8
9
10
# File 'lib/cdmbl/oai_set_lookup.rb', line 8

def oai_sets
  @oai_sets
end

Instance Method Details

#keyedObject



13
14
15
# File 'lib/cdmbl/oai_set_lookup.rb', line 13

def keyed
  oai_sets.at_path('OAI_PMH/ListSets/set').inject({}) {|memo, set| memo.merge(to_key(set)) }
end