Sha256: e8dd05c1cb5095572b4e37506ea4d204f0f468356d467ae13549a562e73d0459

Contents?: true

Size: 745 Bytes

Versions: 7

Compression:

Stored size: 745 Bytes

Contents

require 'active_support/concern'

module Iqvoc
  module Rankable
    extend ActiveSupport::Concern

    def build_rdf(document, subject, suppress_extra_labels = false)
      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

7 entries across 7 versions & 1 rubygems

Version Path
iqvoc-4.7.0 lib/iqvoc/rankable.rb
iqvoc-4.6.1 lib/iqvoc/rankable.rb
iqvoc-4.5.2 lib/iqvoc/rankable.rb
iqvoc-4.6.0 lib/iqvoc/rankable.rb
iqvoc-4.5.1 lib/iqvoc/rankable.rb
iqvoc-4.5.0 lib/iqvoc/rankable.rb
iqvoc-4.4.0 lib/iqvoc/rankable.rb