Sha256: fb57d86cc594387d8bc37af1f3a5b53ce81d2f6b1b67f0f64aa0492e24f5381d

Contents?: true

Size: 626 Bytes

Versions: 58

Compression:

Stored size: 626 Bytes

Contents

module ActiveFedora::WithMetadata
  class DefaultStrategy < ActiveTriples::ExtensionStrategy
    # override apply method to check if property already exists or reciever already has predicate defined.
    # Do not add property if the rdf_resource already responds to the property name
    # Do not add property if the rdf_resource already has a property with the same predicate.
    def self.apply(resource, property)
      return if resource.respond_to?(property.name)
      return if resource.properties.any? { |p| p[1].predicate == property.predicate }
      resource.property property.name, property.to_h
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
active-fedora-12.2.4 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.2.4 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-12.2.3 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.2.3 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.2.2 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.2.0 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.1.3 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-11.5.6 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-12.2.2 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-11.2.1 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-12.2.1 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-12.0.3 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-11.5.5 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.1.2 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.1.1 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.1.0 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-13.0.0 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-12.1.1 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-12.1.0 lib/active_fedora/with_metadata/default_strategy.rb
active-fedora-11.5.4 lib/active_fedora/with_metadata/default_strategy.rb