Class: ActiveFedora::LoadableFromJson::SolrBackedMetadataFile
- Inherits:
-
Object
- Object
- ActiveFedora::LoadableFromJson::SolrBackedMetadataFile
- Defined in:
- lib/active_fedora/loadable_from_json.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
writeonly
Sets the attribute uri.
Instance Method Summary collapse
- #freeze ⇒ Object
-
#initialize ⇒ SolrBackedMetadataFile
constructor
A new instance of SolrBackedMetadataFile.
- #term_values(*terminology) ⇒ Object
-
#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.
Constructor Details
#initialize ⇒ SolrBackedMetadataFile
Returns a new instance of SolrBackedMetadataFile.
10 11 12 |
# File 'lib/active_fedora/loadable_from_json.rb', line 10 def initialize @hash = {} end |
Instance Attribute Details
#uri=(value) ⇒ Object (writeonly)
Sets the attribute uri
26 27 28 |
# File 'lib/active_fedora/loadable_from_json.rb', line 26 def uri=(value) @uri = value end |
Instance Method Details
#freeze ⇒ Object
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 |