Class: R4DigitalNZ::SearchResult
- Inherits:
-
Object
- Object
- R4DigitalNZ::SearchResult
- Includes:
- Enumerable
- Defined in:
- lib/r4digitalnz.rb
Instance Attribute Summary collapse
-
#num_results_requested ⇒ Object
readonly
Returns the value of attribute num_results_requested.
-
#result_count ⇒ Object
readonly
Returns the value of attribute result_count.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each ⇒ Object
-
#initialize(res) ⇒ SearchResult
constructor
A new instance of SearchResult.
Constructor Details
#initialize(res) ⇒ SearchResult
Returns a new instance of SearchResult.
67 68 69 70 71 72 73 74 75 |
# File 'lib/r4digitalnz.rb', line 67 def initialize res @num_results_requested = res['num_results_requested'] @result_count = res['result_count'] @start = res['start'] @results = res["results"].collect do |r| Result.new r end end |
Instance Attribute Details
#num_results_requested ⇒ Object (readonly)
Returns the value of attribute num_results_requested.
63 64 65 |
# File 'lib/r4digitalnz.rb', line 63 def num_results_requested @num_results_requested end |
#result_count ⇒ Object (readonly)
Returns the value of attribute result_count.
64 65 66 |
# File 'lib/r4digitalnz.rb', line 64 def result_count @result_count end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
65 66 67 |
# File 'lib/r4digitalnz.rb', line 65 def start @start end |
Instance Method Details
#[](index) ⇒ Object
81 82 83 |
# File 'lib/r4digitalnz.rb', line 81 def [] index @results[index] end |
#each ⇒ Object
77 78 79 |
# File 'lib/r4digitalnz.rb', line 77 def each @results.each {|r| yield r} end |