Class: ActiveFedora::LoadableFromJson::SolrBackedMetadataFile

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/loadable_from_json.rb

Instance Method Summary collapse

Constructor Details

#initializeSolrBackedMetadataFile


10
11
12
# File 'lib/active_fedora/loadable_from_json.rb', line 10

def initialize
  @hash = {}
end

Instance Method Details

#freezeObject


6
7
8
# File 'lib/active_fedora/loadable_from_json.rb', line 6

def freeze
  @hash.freeze
end

#term_values(*terminology) ⇒ Object


14
15
16
# File 'lib/active_fedora/loadable_from_json.rb', line 14

def term_values *terminology
  @hash.fetch(terminology.first, [])
end

#update_indexed_attributes(hash) ⇒ Object

It is expected that the singular filter gets applied after fetching the value from this resource, so cast everything back to an array.


20
21
22
23
24
# File 'lib/active_fedora/loadable_from_json.rb', line 20

def update_indexed_attributes hash
  hash.each do |k, v|
    @hash[k.first] = Array(v)
  end
end

#uri=(uri) ⇒ Object


26
27
28
# File 'lib/active_fedora/loadable_from_json.rb', line 26

def uri= uri
  @uri = uri
end