Method: Inspec::UI#warning

Defined in:
lib/inspec/ui.rb

#warning(str, opts = { print: true }) ⇒ Object

Issues a one-line message, with ‘WARNING: ’ prepended in bold yellow.



121
122
123
124
125
126
127
128
129
130
131
# File 'lib/inspec/ui.rb', line 121

def warning(str, opts = { print: true })
  str = str.dup.to_s
  result = ''
  result += color? ? ANSI_CODES[:bold] + ANSI_CODES[:color][:yellow] : ''
  result += 'WARNING:'
  result += color? ? ANSI_CODES[:reset] : ''
  result += ' '
  result += str
  result += "\n"
  print_or_return(result, opts[:print])
end