Class: ActiveFedora::Associations::Builder::DirectlyContains

Inherits:
CollectionAssociation show all
Defined in:
lib/active_fedora/associations/builder/directly_contains.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from CollectionAssociation

#proxy

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Class Method Summary collapse

Methods inherited from CollectionAssociation

#add_to_target, #any?, #build, #concat, #concat_records, #count, #create, #create!, #delete, #delete_all, #destroy, #destroy_all, #empty?, #find, #first, #ids_reader, #ids_writer, #include?, #last, #load_from_solr, #load_target, #null_scope?, #reader, #replace, #reset, #scope, #select, #size, #target=, #to_ary, #writer

Methods inherited from Association

#association_scope, #initialize, #initialize_attributes, #load_target, #loaded!, #loaded?, #reload, #reset, #reset_scope, #scope, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

This class inherits a constructor from ActiveFedora::Associations::Association

Class Method Details

.macroObject



3
4
5
# File 'lib/active_fedora/associations/builder/directly_contains.rb', line 3

def self.macro
  :directly_contains
end

.valid_options(options) ⇒ Object



7
8
9
# File 'lib/active_fedora/associations/builder/directly_contains.rb', line 7

def self.valid_options(options)
  super + [:has_member_relation, :is_member_of_relation] - [:predicate]
end

.validate_options(options) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
# File 'lib/active_fedora/associations/builder/directly_contains.rb', line 11

def self.validate_options(options)
  super

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