Module: Resync::Client::Mixins::ListIndex

Includes:
ResourceClientDelegate
Included in:
Resync::ChangeListIndex, ResourceListIndex
Defined in:
lib/resync/client/mixins/list_index.rb

Overview

A resource container whose resources are, themselves, resource containers

Instance Attribute Summary

Attributes included from ClientDelegator

#client_delegate

Instance Method Summary collapse

Methods included from ResourceClientDelegate

#resources=

Methods included from ClientDelegator

#client, #client=

Instance Method Details

#all_resourcesEnumerator::Lazy<Resync::Resource>

Downloads and parses each resource list and returns a flattened enumeration of all resources in each contained list. Each contained list is only downloaded as needed, and only downloaded once.

Returns:

  • (Enumerator::Lazy<Resync::Resource>)

    the flattened enumeration of resources



15
16
17
18
19
20
21
# File 'lib/resync/client/mixins/list_index.rb', line 15

def all_resources
  @resource_lists ||= {}
  resources.lazy.flat_map do |r|
    @resource_lists[r] ||= r.get_and_parse
    @resource_lists[r].resources
  end
end