Class: ChefSpec::Coverage::BlockFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/chefspec/coverage/filters.rb

Overview

Examples:

Match resources based on a custom block.

# Ignore internal cookbooks
add_filter do |resource|
  resource.name =~ /^acme-(.+)/
end

Instance Method Summary collapse

Methods inherited from Filter

#initialize

Constructor Details

This class inherits a constructor from ChefSpec::Coverage::Filter

Instance Method Details

#matches?(resource) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
47
# File 'lib/chefspec/coverage/filters.rb', line 43

def matches?(resource)
  return true if resource.source_line.nil?

  @filter.call(resource)
end