Class: RegistersClient::RecordMapCollection
- Inherits:
-
Object
- Object
- RegistersClient::RecordMapCollection
- Includes:
- Enumerable
- Defined in:
- lib/record_map_collection.rb
Instance Method Summary collapse
- #each ⇒ Object
- #get_records_for_key(key) ⇒ Object
-
#initialize(data, page_size = 100) ⇒ RecordMapCollection
constructor
A new instance of RecordMapCollection.
- #paginator ⇒ Object
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
#each ⇒ Object
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 |
#paginator ⇒ Object
21 22 23 |
# File 'lib/record_map_collection.rb', line 21 def paginator @data.each_slice(@page_size) end |