Module: Resync::Client::Mixins::ChangeIndex
- Includes:
- ResourceClientDelegate
- Included in:
- BaseChangeIndex
- Defined in:
- lib/resync/client/mixins/change_index.rb
Overview
A resource container whose resources are lists of changes.
Instance Attribute Summary
Attributes included from ClientDelegator
Instance Method Summary collapse
-
#all_changes(of_type: nil, in_range: nil) ⇒ Enumerator::Lazy<Resync::Resource>
Downloads and parses each resource list and returns a flattened enumeration of all changes in each contained list, filtering by date/time, change type, or both.
Methods included from ResourceClientDelegate
Methods included from ClientDelegator
Instance Method Details
#all_changes(of_type: nil, in_range: nil) ⇒ Enumerator::Lazy<Resync::Resource>
Downloads and parses each resource list and returns a flattened enumeration of all changes in each contained list, filtering by date/time, change type, or both. (Each contained list is only downloaded as needed, and only downloaded once.) The lists of lists are filtered by from_time
and until_time
, in non-strict mode (only excluding those lists provably not in the range, i.e., including lists without from_time
or until_time
); the individual changes are filtered by modified_time
.
22 23 24 25 26 27 28 29 |
# File 'lib/resync/client/mixins/change_index.rb', line 22 def all_changes(of_type: nil, in_range: nil) @change_lists ||= {} lists = in_range ? change_lists(in_range: in_range, strict: false) : resources lists.lazy.flat_map do |cl| @change_lists[cl] ||= cl.get_and_parse @change_lists[cl].changes(of_type: of_type, in_range: in_range) end end |