lib/couchbase/view.rb in couchbase-jruby-client-0.1.3 vs lib/couchbase/view.rb in couchbase-jruby-client-0.1.4

- old
+ new

@@ -86,12 +86,12 @@ # def initialize(bucket, endpoint, params = {}) @bucket = bucket @endpoint = endpoint @design_doc, @name = parse_endpoint(endpoint) - @params = { :connection_timeout => 75_000 }.merge(params) @wrapper_class = params.delete(:wrapper_class) || ViewRow + @params = { :connection_timeout => 75_000 }.merge(params) unless @wrapper_class.respond_to?(:wrap) raise ArgumentError, "wrapper class should reposond to :wrap, check the options" end end @@ -295,16 +295,16 @@ request = @bucket.client.query(view, query.generate) if block_given? block = Proc.new request.each do |data| - doc = @wrapper_class.wrap(@bucket, data) + doc = @wrapper_class.wrap(@bucket, data.getDocument) block.call(doc) end nil else docs = request.to_a.map { |data| - @wrapper_class.wrap(@bucket, data) + @wrapper_class.wrap(@bucket, data.getDocument) } docs = ArrayWithTotalRows.new(docs) docs.total_rows = request.size docs end