Class: Resync::BaseChangeIndex

Inherits:
SortedResourceList show all
Defined in:
lib/resync/shared/base_change_index.rb

Overview

Adds useful methods to ChangeListIndex, ChangeDumpIndex, and ChangeDump.

Direct Known Subclasses

ChangeDump, ChangeDumpIndex, ChangeListIndex

Instance Attribute Summary

Attributes inherited from SortedResourceList

#resources_by_uri

Attributes inherited from BaseResourceList

#resources

Attributes inherited from Augmented

#links, #metadata

Instance Method Summary collapse

Methods inherited from SortedResourceList

#all_uris, #latest_for, #resources=

Methods inherited from BaseResourceList

#capability, inherited, #initialize, #metadata=, #pre_save, #resource_for, #resources_for, #resources_in

Methods inherited from Augmented

#at_time, #change, #completed_time, #from_time, #initialize, #link_for, #links_for, #until_time

Constructor Details

This class inherits a constructor from Resync::BaseResourceList

Instance Method Details

#change_lists(in_range:, strict: true) ⇒ Array<Resource>

Filters the list of change lists by from/until time. The filter can be strict, in which case only those change lists provably in the range are included, or non-strict, in which case only those change lists provably not in the range are excluded. (This is particularly useful for ChangeDumps, where the from_time and until_time attributes on the individual bitstream packages are optional.)

Parameters:

  • in_range (Range<Time>)

    the range of times to filter by

  • strict (Boolean) (defaults to: true)

    true if resources without from_time or until_time should be excluded, false if they should be included.

Returns:

  • (Array<Resource>)

    those change lists whose from_time or until_time falls within in_range



17
18
19
20
21
# File 'lib/resync/shared/base_change_index.rb', line 17

def change_lists(in_range:, strict: true)
  resources.select do |r|
    strict ? strictly(in_range, r) : loosely(in_range, r)
  end
end