Class: SearchResultRemote
- Inherits:
-
Object
- Object
- SearchResultRemote
- Defined in:
- app/presenters/search_result_remote.rb
Defined Under Namespace
Classes: MetaInformation
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#language ⇒ Object
Returns the value of attribute language.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rdf_namespace ⇒ Object
Returns the value of attribute rdf_namespace.
-
#rdf_predicate ⇒ Object
Returns the value of attribute rdf_predicate.
Instance Method Summary collapse
- #add_meta_information(key, value) ⇒ Object
- #build_rdf(document, subject) ⇒ Object
- #build_search_result_rdf(document, result) ⇒ Object
-
#initialize(host, path, label) ⇒ SearchResultRemote
constructor
A new instance of SearchResultRemote.
- #rdf_predicate_uri ⇒ Object
- #search_result_partial_name ⇒ Object
- #to_s ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(host, path, label) ⇒ SearchResultRemote
Returns a new instance of SearchResultRemote.
14 15 16 17 18 19 |
# File 'app/presenters/search_result_remote.rb', line 14 def initialize(host, path, label) @host = host @path = path @label = label.to_s.squish @meta = [] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
12 13 14 |
# File 'app/presenters/search_result_remote.rb', line 12 def body @body end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
11 12 13 |
# File 'app/presenters/search_result_remote.rb', line 11 def host @host end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
11 12 13 |
# File 'app/presenters/search_result_remote.rb', line 11 def label @label end |
#language ⇒ Object
Returns the value of attribute language.
12 13 14 |
# File 'app/presenters/search_result_remote.rb', line 12 def language @language end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
11 12 13 |
# File 'app/presenters/search_result_remote.rb', line 11 def @meta end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'app/presenters/search_result_remote.rb', line 11 def path @path end |
#rdf_namespace ⇒ Object
Returns the value of attribute rdf_namespace.
12 13 14 |
# File 'app/presenters/search_result_remote.rb', line 12 def rdf_namespace @rdf_namespace end |
#rdf_predicate ⇒ Object
Returns the value of attribute rdf_predicate.
12 13 14 |
# File 'app/presenters/search_result_remote.rb', line 12 def rdf_predicate @rdf_predicate end |
Instance Method Details
#add_meta_information(key, value) ⇒ Object
21 22 23 |
# File 'app/presenters/search_result_remote.rb', line 21 def (key, value) @meta << MetaInformation.new(key, value) end |
#build_rdf(document, subject) ⇒ Object
37 38 39 40 41 42 |
# File 'app/presenters/search_result_remote.rb', line 37 def build_rdf(document, subject) predicate = URI.parse(rdf_predicate_uri) value = body || label subject.build_full_uri_predicate(predicate, value, lang: language) end |
#build_search_result_rdf(document, result) ⇒ Object
44 45 46 47 |
# File 'app/presenters/search_result_remote.rb', line 44 def build_search_result_rdf(document, result) result.Sdc::link(url) build_rdf(document, result) end |
#rdf_predicate_uri ⇒ Object
33 34 35 |
# File 'app/presenters/search_result_remote.rb', line 33 def rdf_predicate_uri rdf_namespace.try(:+, rdf_predicate) end |
#search_result_partial_name ⇒ Object
29 30 31 |
# File 'app/presenters/search_result_remote.rb', line 29 def search_result_partial_name 'search_results/search_result_remote' end |
#to_s ⇒ Object
49 50 51 |
# File 'app/presenters/search_result_remote.rb', line 49 def to_s @label end |
#url ⇒ Object
25 26 27 |
# File 'app/presenters/search_result_remote.rb', line 25 def url host + path end |