Sha256: d65d9d36f50d7655e434fb8e70c35e8e2f98e5cdd9ad72cad67bd6aba6cbace2

Contents?: true

Size: 730 Bytes

Versions: 15

Compression:

Stored size: 730 Bytes

Contents

class SearchResult
  extend Forwardable
  def_delegators :@result_object, :build_search_result_rdf, :owner, :target,
      :value, :label, :rdf_namespace, :rdf_predicate

  def initialize(result_object)
    @result_object = result_object
  end

  def model_name
    @result_object.class.model_name
  end

  def search_result_partial_name
    @result_object.class.search_result_partial_name
  end

  def language
    if @result_object.is_a?(Labeling::Base)
      @result_object.target.try(:language)
    else
      @result_object.try(:language)
    end
  end

  def to_s
    if @result_object.is_a?(Labeling::Base)
      @result_object.target.value
    else
      @result_object.try(:owner).try(:pref_label).to_s
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
iqvoc-4.9.0 app/presenters/search_result.rb
iqvoc-4.3.3 app/presenters/search_result.rb
iqvoc-4.8.2 app/presenters/search_result.rb
iqvoc-4.8.1 app/presenters/search_result.rb
iqvoc-4.8.0 app/presenters/search_result.rb
iqvoc-4.7.0 app/presenters/search_result.rb
iqvoc-4.6.1 app/presenters/search_result.rb
iqvoc-4.5.2 app/presenters/search_result.rb
iqvoc-4.6.0 app/presenters/search_result.rb
iqvoc-4.5.1 app/presenters/search_result.rb
iqvoc-4.5.0 app/presenters/search_result.rb
iqvoc-4.4.0 app/presenters/search_result.rb
iqvoc-4.3.2 app/presenters/search_result.rb
iqvoc-4.3.1 app/presenters/search_result.rb
iqvoc-4.3.0 app/presenters/search_result.rb