Class: Couchbase::Cluster::QueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/query_options.rb,
/code/couchbase-ruby-client/lib/couchbase/query_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ QueryResult

Returns a new instance of QueryResult.

Yield Parameters:



41
42
43
44
# File 'lib/couchbase/query_options.rb', line 41

def initialize
  yield self if block_given?
  @transcoder = :json
end

Instance Attribute Details

#meta_dataQueryMetaData

Returns object representing additional metadata associated with this query

Returns:

  • (QueryMetaData)

    returns object representing additional metadata associated with this query



23
24
25
# File 'lib/couchbase/query_options.rb', line 23

def 
  @meta_data
end

#transcoderObject

Returns the value of attribute transcoder.



25
26
27
# File 'lib/couchbase/query_options.rb', line 25

def transcoder
  @transcoder
end

Instance Method Details

#rows(transcoder = self.transcoder) ⇒ Array

Returns all rows converted using a transcoder

Returns:

  • (Array)


30
31
32
33
34
35
36
37
38
# File 'lib/couchbase/query_options.rb', line 30

def rows(transcoder = self.transcoder)
  @rows.lazy.map do |row|
    if transcoder == :json
      JSON.parse(row)
    else
      transcoder.call(row)
    end
  end
end