Class: Couchbase::Cluster::QueryResult

Inherits:
Object
  • Object
show all
Defined in:
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:

[View source]

163
164
165
166
# File 'lib/couchbase/query_options.rb', line 163

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


145
146
147
# File 'lib/couchbase/query_options.rb', line 145

def 
  @meta_data
end

#transcoderObject

Returns the value of attribute transcoder.


147
148
149
# File 'lib/couchbase/query_options.rb', line 147

def transcoder
  @transcoder
end

Instance Method Details

#rows(transcoder = self.transcoder) ⇒ Array

Returns all rows converted using a transcoder

Returns:

  • (Array)
[View source]

152
153
154
155
156
157
158
159
160
# File 'lib/couchbase/query_options.rb', line 152

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