Class: SearchResult
- Inherits:
-
Object
- Object
- SearchResult
- Extended by:
- Forwardable
- Defined in:
- app/presenters/search_result.rb
Instance Attribute Summary collapse
-
#result_object ⇒ Object
readonly
Returns the value of attribute result_object.
Instance Method Summary collapse
-
#initialize(result_object) ⇒ SearchResult
constructor
A new instance of SearchResult.
- #language ⇒ Object
- #model_name ⇒ Object
- #search_result_partial_name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(result_object) ⇒ SearchResult
Returns a new instance of SearchResult.
7 8 9 |
# File 'app/presenters/search_result.rb', line 7 def initialize(result_object) @result_object = result_object end |
Instance Attribute Details
#result_object ⇒ Object (readonly)
Returns the value of attribute result_object.
3 4 5 |
# File 'app/presenters/search_result.rb', line 3 def result_object @result_object end |
Instance Method Details
#language ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/presenters/search_result.rb', line 19 def language if @result_object.is_a?(Labeling::Base) @result_object.target.try(:language) else @result_object.try(:language) end end |
#model_name ⇒ Object
11 12 13 |
# File 'app/presenters/search_result.rb', line 11 def model_name @result_object.class.model_name end |
#search_result_partial_name ⇒ Object
15 16 17 |
# File 'app/presenters/search_result.rb', line 15 def search_result_partial_name @result_object.class.search_result_partial_name end |
#to_s ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/presenters/search_result.rb', line 27 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 |