lib/couch.rb
# If a block is given, performs the block for each +limit+-sized slice of _all_docs.
# If no block is given, returns all docs by appending +limit+-sized slices of _all_docs.
#
# This method assumes your docs don't have the high-value Unicode character \ufff0. If it does, then behaviour is undefined. The reason why we use the startkey parameter instead of skip is that startkey is faster.
If a block is given, performs the block for each +limit+-sized slice of _all_docs.
If no block is given, returns all docs by appending +limit+-sized slices of _all_docs.

This method assumes your docs don't have the high-value Unicode character \ufff0. If it does, then behaviour is undefined. The reason why we use the startkey parameter instead of skip is that startkey is faster.
If a block is given performs the block for each + limit + - sized slice of _all_docs . If no block is given returns all docs by appending + limit + - sized slices of _all_docs . This method assumes your docs don ' t have the high - value Unicode character \ ufff0 . If it does then behaviour is undefined . The reason why we use the startkey parameter instead of skip is that startkey is faster .
def all_docs(db, limit=750, opts={}, &block)
        all_docs = []
        start_key = nil
        loop do
          opts = opts.merge({limit: limit})
          if start_key
            opts[:startkey]=start_key
          end
          docs = (lambda { |options| get_all_docs(db, options) }).call(opts)
          if docs.length <= 0
            break
          else
            if block
              block.call(docs)
            else
              all_docs < docs
            end
            start_key ="\"#{docs.last['_id']}\\ufff0\""
          end
        end
        all_docs.flatten
      end
def all_docs ( db , limit = 750 , opts = { } , & block ) all_docs = [ ] start_key = nil loop do opts = opts . merge ( { limit : limit } ) if start_key opts [ :startkey ] = start_key end docs = ( lambda { | options | get_all_docs ( db , options ) } ) . call ( opts ) if docs . length <= 0 break else if block block . call ( docs ) else all_docs < docs end start_key = "\"#{docs.last['_id']}\\ufff0\"" end end all_docs . flatten end
If a block is given, performs the block for each +limit+-sized slice of _all_docs.
If a block is given performs the block for each + limit + - sized slice of _all_docs .
db
<not_specific>
limit
<not_specific>
opts
<not_specific>
block
<not_specific>