Class: CouchPotato::View::RawViewSpec

Inherits:
BaseViewSpec show all
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']}}

example:

view :my_custom_view, :map => "function(doc) { emit(doc._id, null); }", :type => :raw, :lib => {:module => "exports.name = 'module';"

Instance Attribute Summary

Attributes inherited from BaseViewSpec

#design_document, #language, #list_function, #list_name, #view_name, #view_parameters

Instance Method Summary (collapse)

Methods inherited from BaseViewSpec

#initialize, #process_results

Constructor Details

This class inherits a constructor from CouchPotato::View::BaseViewSpec

Instance Method Details

- (Object) lib



23
24
25
# File 'lib/couch_potato/view/raw_view_spec.rb', line 23

def lib
  options[:lib]
end

- (Object) map_function



15
16
17
# File 'lib/couch_potato/view/raw_view_spec.rb', line 15

def map_function
  options[:map]
end

- (Object) reduce_function



19
20
21
# File 'lib/couch_potato/view/raw_view_spec.rb', line 19

def reduce_function
  options[:reduce]
end