Class: ActiveFedora::OmAttribute
- Inherits:
-
StreamAttribute
- Object
- DelegatedAttribute
- StreamAttribute
- ActiveFedora::OmAttribute
- Defined in:
- lib/active_fedora/attributes/om_attribute.rb
Overview
Class for attributes that are delegated to an OmDatastream
Instance Attribute Summary
Attributes inherited from StreamAttribute
#at, #delegate_target, #target_class
Attributes inherited from DelegatedAttribute
Instance Method Summary collapse
Methods inherited from StreamAttribute
#initialize, #primary_solr_name, #type
Methods inherited from DelegatedAttribute
Constructor Details
This class inherits a constructor from ActiveFedora::StreamAttribute
Instance Method Details
#reader(obj, *opts) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/active_fedora/attributes/om_attribute.rb', line 18 def reader(obj, *opts) ds = file_for_attribute(obj, delegate_target) terminology = at || [field] if terminology.length == 1 && opts.present? ds.send(terminology.first, *opts) else ds.send(:term_values, *terminology) end end |
#writer(obj, v) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/active_fedora/attributes/om_attribute.rb', line 9 def writer(obj, v) ds = file_for_attribute(obj, delegate_target) obj.mark_as_changed(field) if obj.value_has_changed?(field, v) terminology = at || [field] ds.send(:update_indexed_attributes, {terminology => v}) end |