def filter_resource?(resource, test_module)
      if @filters.include?(resource.to_s)
        return true
      end

      if resource.type == 'Class'
        module_name = resource.title.split('::').first.downcase
        if module_name != test_module
          return true
        end
      end

      if resource.file
        paths = module_paths(test_module)
        unless paths.any? { |path| resource.file.include?(path) }
          return true
        end
      end

      return false
    end
def filter_resource?(resource, test_module)
      if @filters.include?(resource.to_s)
        return true
      end

      if resource.type == 'Class'
        module_name = resource.title.split('::').first.downcase
        if module_name != test_module
          return true
        end
      end

      if resource.file
        paths = module_paths(test_module)
        unless paths.any? { |path| resource.file.include?(path) }
          return true
        end
      end

      return false
    end
Should this resource be excluded from coverage reports?

 The resource is not included in coverage reports if any of the conditions hold:

   * The resource has been explicitly filtered out.
     * Examples: autogenerated resources such as 'Stage[main]'
   * The resource is a class but does not belong to the module under test.
     * Examples: Class dependencies included from a fixture module
   * The resource was declared in a file outside of the test module or site.pp
     * Examples: Resources declared in a dependency of this module.

 @param resource [Puppet::Resource] The resource that may be filtered
 @param test_module [String] The name of the module under test
 @return [true, false]