Class: LyricsSearch::SearchResults
- Inherits:
-
Object
- Object
- LyricsSearch::SearchResults
- Defined in:
- lib/lyrics_search/search_results.rb
Defined Under Namespace
Classes: SearchResult
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(result, search_type) ⇒ SearchResults
constructor
A new instance of SearchResults.
Constructor Details
#initialize(result, search_type) ⇒ SearchResults
Returns a new instance of SearchResults.
6 7 8 9 10 11 |
# File 'lib/lyrics_search/search_results.rb', line 6 def initialize(result, search_type) results = result.dig((search_type + '_response').to_sym, (search_type + '_result').to_sym, :search_lyric_result). compact.select{|res| !res[:lyric_id].to_i.zero?} results.inject(@results = []){|results, result| results << SearchResult.new(result)} if results end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
4 5 6 |
# File 'lib/lyrics_search/search_results.rb', line 4 def results @results end |