Class: CassandraModel::ResultChunker

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/cassandra_model/result_chunker.rb

Instance Method Summary collapse

Constructor Details

#initialize(enum, cluster) ⇒ ResultChunker

Returns a new instance of ResultChunker.



5
6
7
8
# File 'lib/cassandra_model/result_chunker.rb', line 5

def initialize(enum, cluster)
  @enum = enum
  @cluster = cluster
end

Instance Method Details

#==(rhs) ⇒ Object



18
19
20
21
22
# File 'lib/cassandra_model/result_chunker.rb', line 18

def ==(rhs)
  rhs.is_a?(ResultChunker) &&
      enum == rhs.enum &&
      cluster == rhs.cluster
end

#each(&block) ⇒ Object



10
11
12
13
14
# File 'lib/cassandra_model/result_chunker.rb', line 10

def each(&block)
  enum.chunk do |value|
    value.attributes.values_at(*cluster)
  end.each(&block)
end