Sha256: 583c9239dc244ab7b1af4fd671b2751a50971adccf34971d6a8535be6368585f

Contents?: true

Size: 1.09 KB

Versions: 32

Compression:

Stored size: 1.09 KB

Contents

module ActiveFedora
  module Rdf
    class NodeConfig
      attr_accessor :predicate, :term, :class_name, :type, :behaviors, :multivalue

      def initialize(term, predicate, args={})
        self.term = term
        self.predicate = predicate
        self.class_name = args.delete(:class_name)
        self.multivalue = args.delete(:multivalue) { true } 
        raise ArgumentError, "Invalid arguments for Rdf Node configuration: #{args} on #{predicate}" unless args.empty?
      end


      def with_index (&block)
        # needed for solrizer integration
        iobj = IndexObject.new
        yield iobj
        self.type = iobj.data_type
        self.behaviors = iobj.behaviors
      end

      # this enables a cleaner API for solr integration
      class IndexObject
        attr_accessor :data_type, :behaviors
        def initialize
          @behaviors = []
          @data_type = :string
        end
        def as(*args)
          @behaviors = args
        end
        def type(sym)
          @data_type = sym
        end
        def defaults
          :noop
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
active-fedora-6.8.0 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.8 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.1 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0.rc3 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.7 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0.rc2 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.6 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0.rc1 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.5 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0.pre3 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.4 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0.pre2 lib/active_fedora/rdf/node_config.rb
active-fedora-7.0.0.pre1 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.3 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.2 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.1 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.0 lib/active_fedora/rdf/node_config.rb
active-fedora-6.7.0.rc1 lib/active_fedora/rdf/node_config.rb
active-fedora-6.6.1 lib/active_fedora/rdf/node_config.rb