Class CouchPotato::View::RawViewSpec
In: lib/couch_potato/view/raw_view_spec.rb
Parent: CouchPotato::View::BaseViewSpec

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']}}

Methods

Public Instance methods

[Source]

    # File lib/couch_potato/view/raw_view_spec.rb, line 12
12:       def map_function
13:         options[:map]
14:       end

[Source]

    # File lib/couch_potato/view/raw_view_spec.rb, line 16
16:       def process_results(results)
17:         options[:results_filter] ? options[:results_filter].call(results) : results
18:       end

[Source]

    # File lib/couch_potato/view/raw_view_spec.rb, line 20
20:       def reduce_function
21:         options[:reduce]
22:       end

[Validate]