Sha256: 7802450282742c2b59e3f2515d10e295932896fa15f099a2fb25b01d26d5e7b7

Contents?: true

Size: 781 Bytes

Versions: 11

Compression:

Stored size: 781 Bytes

Contents

module ActiveFedora::Associations::Builder
  class DirectlyContains < CollectionAssociation #:nodoc:
    self.macro = :directly_contains
    self.valid_options += [:has_member_relation, :is_member_of_relation]
    self.valid_options -= [:predicate]

    def build
      reflection = super
      configure_dependency
      reflection
    end

    def validate_options
      super
      if !options[:has_member_relation] && !options[:is_member_of_relation]
        raise ArgumentError, "You must specify a :has_member_relation or :is_member_of_relation predicate for #{name}"
      elsif !options[:has_member_relation].is_a?(RDF::URI) && !options[:is_member_of_relation].is_a?(RDF::URI)
        raise ArgumentError, "Predicate must be a kind of RDF::URI"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-9.7.3 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.7.2 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.9.1 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.9.0 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.8.2 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.8.1 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.8.0 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.7.1 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.7.0 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.6.2 lib/active_fedora/associations/builder/directly_contains.rb
active-fedora-9.6.1 lib/active_fedora/associations/builder/directly_contains.rb