Sha256: f1772283ac52c0151ff4f8c274292d9493596f0f5a746729e2c0a6437f46dd2e
Contents?: true
Size: 1.15 KB
Versions: 5
Compression:
Stored size: 1.15 KB
Contents
module ActiveFedora::Orders class Builder < ActiveFedora::Associations::Builder::CollectionAssociation include ActiveFedora::AutosaveAssociation::AssociationBuilderExtension self.macro = :orders self.valid_options += [:through, :ordered_reflection] def self.define_readers(mixin, name) super mixin.redefine_method(target_accessor(name)) do association(name).target_reader end mixin.redefine_method("#{target_accessor(name)}=") do |nodes| association(name).target_writer(nodes) end end def initialize(model, name, options) @original_name = name @model = model name = :"ordered_#{name.to_s.singularize}_proxies" options = {ordered_reflection: ordered_reflection}.merge(options) super end def build super.tap do model.property :head, predicate: ::RDF::Vocab::IANA['first'] model.property :tail, predicate: ::RDF::Vocab::IANA.last end end private def self.target_accessor(name) name.to_s.gsub("_proxies","").pluralize end def ordered_reflection model.reflect_on_association(@original_name) end end end
Version data entries
5 entries across 5 versions & 1 rubygems