Class: CouchPotato::View::ViewQuery
- Inherits:
-
Object
- Object
- CouchPotato::View::ViewQuery
- Defined in:
- lib/couch_potato/view/view_query.rb
Overview
Used to query views (and create them if they don’t exist). Usually you won’t have to use this class directly. Instead it is used internally by the CouchPotato::Database.view method.
Instance Method Summary collapse
-
#initialize(couchrest_database, design_document_name, view_name, map_function, reduce_function = nil) ⇒ ViewQuery
constructor
A new instance of ViewQuery.
- #query_view!(parameters = {}) ⇒ Object
Constructor Details
#initialize(couchrest_database, design_document_name, view_name, map_function, reduce_function = nil) ⇒ ViewQuery
Returns a new instance of ViewQuery.
5 6 7 8 9 10 11 |
# File 'lib/couch_potato/view/view_query.rb', line 5 def initialize(couchrest_database, design_document_name, view_name, map_function, reduce_function = nil) @database = couchrest_database @design_document_name = design_document_name @view_name = view_name @map_function = map_function @reduce_function = reduce_function end |
Instance Method Details
#query_view!(parameters = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/couch_potato/view/view_query.rb', line 13 def query_view!(parameters = {}) begin query_view parameters rescue RestClient::ResourceNotFound# => e create_view retry end end |