Class: Couchup::MapReduce
- Inherits:
-
Object
- Object
- Couchup::MapReduce
- Defined in:
- lib/couchup/mapreduce.rb
Class Method Summary collapse
Class Method Details
.map(*params) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/couchup/mapreduce.rb', line 3 def self.map(*params) #FIXME. should probably get view meta data to do one view call. but this is also doing 2 calls. begin response = view({:include_docs => true}, *params) rescue RestClient::BadRequest response = view({:reduce => false, :include_docs => true}, *params) end docs = response["rows"].collect do |r| r["doc"].instance_eval "def save ::Couchup::Couchup.database.save_doc(self) end " r["doc"] end end |
.reduce(*params) ⇒ Object
21 22 23 |
# File 'lib/couchup/mapreduce.rb', line 21 def self.reduce(*params) view({:reduce => true,:group => true}, *params) end |