Sha256: 0aae79e284705aa3a87f6136074630383279227dbd99a56e957fc78529ae19b3
Contents?: true
Size: 877 Bytes
Versions: 13
Compression:
Stored size: 877 Bytes
Contents
module ActiveFedora::Associations::Builder class Contains < SingularAssociation #:nodoc: self.macro = :contains self.valid_options += [:autocreate, :block] def initialize(model, name, options) super options[:class_name] = 'ActiveFedora::File' if options[:class_name].blank? end def validate_options super if options[:class_name] && !options[:class_name].is_a?(String) raise ArgumentError, ":class_name must be a string for contains '#{name}'" unless options[:class_name].is_a? String end end def self.define_readers(mixin, name) mixin.send(:define_method, name) do |*params| association(name).reader(*params).tap do |file| set_uri = uri.kind_of?(RDF::URI) ? uri.value.present? : uri.present? file.uri = "#{uri}/#{name}" if set_uri end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems