Method: Inspec::UI#error

Defined in:
lib/inspec/ui.rb

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

Issues a one-line message, with ‘ERROR: ’ prepended in bold red.



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/inspec/ui.rb', line 109

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