Class: CouchRest::Design
- Inherits:
-
Object
- Object
- CouchRest::Design
- Defined in:
- lib/couchrest/extensions.rb
Instance Method Summary collapse
-
#list(list_name, view_name, query = {}) ⇒ Object
Dispatches to any named view.
-
#view(view_name, query = {}, &block) ⇒ Object
Dispatches to any named view.
-
#view_on(db, view_name, query = {}, &block) ⇒ Object
Dispatches to any named view in a specific database.
Instance Method Details
#list(list_name, view_name, query = {}) ⇒ Object
Dispatches to any named view. (using the database where this design doc was saved)
27 28 29 |
# File 'lib/couchrest/extensions.rb', line 27 def list(list_name, view_name, query = {}) database.list(list_name, view_name.to_s, name, query) end |
#view(view_name, query = {}, &block) ⇒ Object
Dispatches to any named view. (using the database where this design doc was saved)
33 34 35 |
# File 'lib/couchrest/extensions.rb', line 33 def view view_name, query={}, &block view_on database, view_name, query, &block end |
#view_on(db, view_name, query = {}, &block) ⇒ Object
Dispatches to any named view in a specific database
38 39 40 41 42 43 |
# File 'lib/couchrest/extensions.rb', line 38 def view_on db, view_name, query={}, &block view_name = view_name.to_s view_slug = "#{name}/#{view_name}" defaults = (self['views'][view_name] && self['views'][view_name]["couchrest-defaults"]) || {} db.view(view_slug, defaults.merge(query), &block) end |