Class: ArrayDatasource

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rotating_es_loader/array_datasource.rb

Overview

:nodoc

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ArrayDatasource

Returns a new instance of ArrayDatasource.



7
8
9
10
# File 'lib/rotating_es_loader/array_datasource.rb', line 7

def initialize(data)
  @data = data
  @iter = data.each
end

Instance Method Details

#each(&block) ⇒ Object



12
13
14
15
16
17
# File 'lib/rotating_es_loader/array_datasource.rb', line 12

def each(&block)
  return to_enum(:each) unless block

  @data.each(&block)
  self
end

#sizeObject



19
20
21
# File 'lib/rotating_es_loader/array_datasource.rb', line 19

def size
  @data.size
end