Method: Chef::ActionCollection#filtered_collection

Defined in:
lib/chef/action_collection.rb

#filtered_collection(max_nesting: nil, up_to_date: true, skipped: true, updated: true, failed: true, unprocessed: true) ⇒ Chef::ActionCollection

Allows getting at the action_records collection filtered by nesting level and status.

TODO: filtering by resource type+name



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/chef/action_collection.rb', line 107

def filtered_collection(max_nesting: nil, up_to_date: true, skipped: true, updated: true, failed: true, unprocessed: true)
  subrecords = action_records.select do |rec|
    ( max_nesting.nil? || rec.nesting_level <= max_nesting ) &&
      ( rec.status == :up_to_date && up_to_date ||
        rec.status == :skipped && skipped ||
        rec.status == :updated && updated ||
        rec.status == :failed && failed ||
        rec.status == :unprocessed && unprocessed )
  end
  self.class.new(events, run_context, subrecords)
end