diff options
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/checkable.rb')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/checkable.rb | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/checkable.rb b/Library/Homebrew/cask/lib/hbc/checkable.rb index 9c12f80ca..42c47ea78 100644 --- a/Library/Homebrew/cask/lib/hbc/checkable.rb +++ b/Library/Homebrew/cask/lib/hbc/checkable.rb @@ -1,51 +1,53 @@ -module Hbc::Checkable - def errors - Array(@errors) - end +module Hbc + module Checkable + def errors + Array(@errors) + end - def warnings - Array(@warnings) - end + def warnings + Array(@warnings) + end - def add_error(message) - @errors ||= [] - @errors << message - end + def add_error(message) + @errors ||= [] + @errors << message + end - def add_warning(message) - @warnings ||= [] - @warnings << message - end + def add_warning(message) + @warnings ||= [] + @warnings << message + end - def errors? - Array(@errors).any? - end + def errors? + Array(@errors).any? + end - def warnings? - Array(@warnings).any? - end + def warnings? + Array(@warnings).any? + end - def result - if errors? - "#{Tty.red}failed#{Tty.reset}" - elsif warnings? - "#{Tty.yellow}warning#{Tty.reset}" - else - "#{Tty.green}passed#{Tty.reset}" + def result + if errors? + "#{Tty.red}failed#{Tty.reset}" + elsif warnings? + "#{Tty.yellow}warning#{Tty.reset}" + else + "#{Tty.green}passed#{Tty.reset}" + end end - end - def summary - summary = ["#{summary_header}: #{result}"] + def summary + summary = ["#{summary_header}: #{result}"] - errors.each do |error| - summary << " #{Tty.red}-#{Tty.reset} #{error}" - end + errors.each do |error| + summary << " #{Tty.red}-#{Tty.reset} #{error}" + end - warnings.each do |warning| - summary << " #{Tty.yellow}-#{Tty.reset} #{warning}" - end + warnings.each do |warning| + summary << " #{Tty.yellow}-#{Tty.reset} #{warning}" + end - summary.join("\n") + summary.join("\n") + end end end |
