Class: CouchPotato::View::CustomViewSpec
Overview
a view for custom map/reduce functions that still returns model instances example: view :my_custom_view, :map => “function(doc) { emit(doc._id, null); }”, :include_docs => true, :type => :custom, :reduce => nil
Instance Attribute Summary
Attributes inherited from BaseViewSpec
#design_document, #view_name
Instance Method Summary
collapse
#initialize
Instance Method Details
#map_function ⇒ Object
7
8
9
|
# File 'lib/couch_potato/view/custom_view_spec.rb', line 7
def map_function
options[:map]
end
|
#process_results(results) ⇒ Object
19
20
21
22
23
|
# File 'lib/couch_potato/view/custom_view_spec.rb', line 19
def process_results(results)
results['rows'].map do |row|
klass.json_create row['doc'] || row['value'].merge(:_id => row['id'])
end
end
|
#reduce_function ⇒ Object
11
12
13
|
# File 'lib/couch_potato/view/custom_view_spec.rb', line 11
def reduce_function
options[:reduce]
end
|
#view_parameters ⇒ Object
15
16
17
|
# File 'lib/couch_potato/view/custom_view_spec.rb', line 15
def view_parameters
{:include_docs => options[:include_docs] || false}.merge(super)
end
|