Sha256: 198cd501cdceff267e6656431559baea936817bec81ff1ce943a2f27535ca6b5

Contents?: true

Size: 940 Bytes

Versions: 10

Compression:

Stored size: 940 Bytes

Contents

module ActiveFedora

  # Class for attributes that are delegated to an OmDatastream

  class OmAttribute < StreamAttribute

    # @param [ActiveFedora::Base] obj the object that has the attribute
    # @param [Object] v value to write to the attribute
    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

    # @param [ActiveFedora::Base] obj the object that has the attribute
    # @param [Object] opts extra options that are passed to the target reader
    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

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active-fedora-9.5.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.4.3 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.4.2 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.4.1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.4.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.3.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.2.1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.2.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.2.0.rc2 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.2.0.rc1 lib/active_fedora/attributes/om_attribute.rb