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)


120
121
122
123
124
125
# File 'lib/inspec/rule.rb', line 120

def only_if
  return unless block_given?
  return if @__skip_only_if_eval == true

  @__skip_rule ||= !yield
end