Class: RegistersClient::RecordMapCollection

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

Instance Method Summary collapse

Constructor Details

#initialize(data, page_size = 100) ⇒ RecordMapCollection

Returns a new instance of RecordMapCollection.



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

def initialize(data, page_size = 100)
  @data = data
  @page_size = page_size
end

Instance Method Details

#eachObject



10
11
12
13
14
15
# File 'lib/record_map_collection.rb', line 10

def each
  @data.each do |key,val|
    result = {key: key, records: val}
    yield result
  end
end

#get_records_for_key(key) ⇒ Object



17
18
19
# File 'lib/record_map_collection.rb', line 17

def get_records_for_key(key)
  @data.fetch(key)
end

#paginatorObject



21
22
23
# File 'lib/record_map_collection.rb', line 21

def paginator
  @data.each_slice(@page_size)
end