# class Chef::ChefFS::FileSystem::PairLister

### Attributes

a_root[R]
b_root[R]
pattern[R]

### Public Class Methods

new(pattern, a_root, b_root) click to toggle source

    # File lib/chef/chef_fs/file_system.rb, line 177
    def initialize(pattern, a_root, b_root)
      @pattern = pattern
      @a_root = a_root
      @b_root = b_root
    end

### Public Instance Methods

each() { |a, b| ... } click to toggle source

    # File lib/chef/chef_fs/file_system.rb, line 187
    def each
      # Make sure everything on the server is also on the filesystem, and diff
      found_paths = Set.new
      Chef::ChefFS::FileSystem.list(a_root, pattern).each do |a|
        found_paths << a.path
        b = Chef::ChefFS::FileSystem.resolve_path(b_root, a.path)
        yield [ a, b ]
      end

      # Check the outer regex pattern to see if it matches anything on the
      # filesystem that isn't on the server
      Chef::ChefFS::FileSystem.list(b_root, pattern).each do |b|
        if !found_paths.include?(b.path)
          a = Chef::ChefFS::FileSystem.resolve_path(a_root, b.path)
          yield [ a, b ]
        end
      end
    end