Sha256: 300f74ec30162e9ad8ca3ccfa78f980f30d05afa48edb953170aa5bb3292aa32

Contents?: true

Size: 363 Bytes

Versions: 4

Compression:

Stored size: 363 Bytes

Contents

class Cql::Model::QueryResult
  include Enumerable

  attr_reader :metadata

  def initialize(results, klass)
    @metadata = results.metadata
    @rows = results.collect {|result| klass.new(result, metadata: @metadata)}
  end

  def empty?
    @rows.nil? || @rows.empty?
  end

  def each(&block)
    @rows.each(&block)
  end
  alias_method :each_row, :each
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cql_model-0.0.5 lib/cql/model/query_result.rb
cql_model-0.0.4 lib/cql/model/query_result.rb
cql_model-0.0.3 lib/cql/model/query_result.rb
cql_model-0.0.2 lib/cql/model/query_result.rb