Class: CouchPotato::View::RawViewSpec
- Inherits:
-
BaseViewSpec
- Object
- BaseViewSpec
- CouchPotato::View::RawViewSpec
- Defined in:
- lib/couch_potato/view/raw_view_spec.rb
Overview
A view for custom map/reduce functions that returns the raw data fromcouchdb
example:
view :my_custom_view, :map => "function(doc) { emit(doc._id, null); }", :type => :raw, :reduce => nil
optionally you can pass in a results filter which you can use to process the raw couchdb results before returning them
example:
view :my_custom_view, :map => "function(doc) { emit(doc._id, null); }", :type => :raw, :results_filter => lambda{|results| results['rows].map{|row| row['value']}}
Instance Attribute Summary
Attributes inherited from BaseViewSpec
#design_document, #list_function, #list_name, #view_name, #view_parameters
Instance Method Summary collapse
Methods inherited from BaseViewSpec
Constructor Details
This class inherits a constructor from CouchPotato::View::BaseViewSpec
Instance Method Details
#map_function ⇒ Object
12 13 14 |
# File 'lib/couch_potato/view/raw_view_spec.rb', line 12 def map_function [:map] end |
#process_results(results) ⇒ Object
16 17 18 |
# File 'lib/couch_potato/view/raw_view_spec.rb', line 16 def process_results(results) [:results_filter] ? [:results_filter].call(results) : results end |
#reduce_function ⇒ Object
20 21 22 |
# File 'lib/couch_potato/view/raw_view_spec.rb', line 20 def reduce_function [:reduce] end |