Method: Inspec::Rule#only_if

Defined in:
lib/inspec/rule.rb

#only_ifnil

Skip all checks if only_if is false

Parameters:

  • &block (Type)

    returns true if tests are added, false otherwise

Returns:

  • (nil)


103
104
105
106
# File 'lib/inspec/rule.rb', line 103

def only_if
  return unless block_given?
  @__skip_rule ||= !yield
end