Sha256: 93192ffe35f4516504f131713e75b3fd120497757e2db34677779156cf9df1fb

Contents?: true

Size: 715 Bytes

Versions: 15

Compression:

Stored size: 715 Bytes

Contents

require 'active_support/concern'

module Iqvoc
  module Rankable
    extend ActiveSupport::Concern

    def build_rdf(document, subject)
      super
      if self.class.rankable?
        predicate = "ranked#{rdf_predicate.titleize}"

        subject.Schema.build_predicate(predicate) do |blank_node|
          blank_node.Schema.relationWeight(rank)
          blank_node.Schema.relationTarget(IqRdf.build_uri(target.origin))
        end
      end
    end

    module ClassMethods
      def rankable?
        true
      end

      def partial_name(obj)
        'partials/concept/relation/ranked'
      end

      def edit_partial_name(obj)
        'partials/concept/relation/edit_ranked'
      end
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
iqvoc-4.1.3 lib/iqvoc/rankable.rb
iqvoc-4.1.2 lib/iqvoc/rankable.rb
iqvoc-4.1.1 lib/iqvoc/rankable.rb
iqvoc-4.1.0 lib/iqvoc/rankable.rb
iqvoc-4.0.9 lib/iqvoc/rankable.rb
iqvoc-4.0.8 lib/iqvoc/rankable.rb
iqvoc-4.0.7 lib/iqvoc/rankable.rb
iqvoc-4.0.6 lib/iqvoc/rankable.rb
iqvoc-4.0.5 lib/iqvoc/rankable.rb
iqvoc-4.0.4 lib/iqvoc/rankable.rb
iqvoc-4.0.3 lib/iqvoc/rankable.rb
iqvoc-4.0.2 lib/iqvoc/rankable.rb
iqvoc-4.0.1 lib/iqvoc/rankable.rb
iqvoc-4.0.0 lib/iqvoc/rankable.rb
iqvoc-3.5.7 lib/iqvoc/rankable.rb