Sha256: a2878126e7848c5939aa1d0ea402f61a5e722f8430d070b68c301d4b06f74ee9

Contents?: true

Size: 935 Bytes

Versions: 21

Compression:

Stored size: 935 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

21 entries across 21 versions & 1 rubygems

Version Path
active-fedora-9.7.3 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.7.2 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.13.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.12.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.11.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.4 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.3 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.2 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.0.pre2 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.10.0.pre1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.9.1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.9.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.8.2 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.8.1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.8.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.7.1 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.7.0 lib/active_fedora/attributes/om_attribute.rb
active-fedora-9.6.2 lib/active_fedora/attributes/om_attribute.rb