Class: Tapirgo::Search
- Inherits:
-
Object
- Object
- Tapirgo::Search
- Includes:
- Enumerable, Errors
- Defined in:
- lib/tapirgo/search.rb,
lib/tapirgo/search/result.rb
Overview
Tapir search class
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each ⇒ Object
-
#initialize(token, query_str) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(token, query_str) ⇒ Search
Returns a new instance of Search.
32 33 34 35 36 37 |
# File 'lib/tapirgo/search.rb', line 32 def initialize(token, query_str) @token = token @query = query_str @results = JSON.parse(get).map { |r| Search::Result.new(r) } self end |
Instance Method Details
#[](index) ⇒ Object
39 40 41 |
# File 'lib/tapirgo/search.rb', line 39 def [](index) results[index] end |
#each ⇒ Object
43 44 45 |
# File 'lib/tapirgo/search.rb', line 43 def each results.each { |r| yield(r) } end |