Class: Renegade::HandleErrors
- Inherits:
-
Object
- Object
- Renegade::HandleErrors
- Defined in:
- lib/renegade/handle_errors.rb
Overview
Handle errors
Class Method Summary collapse
-
.handle_errors(errors) ⇒ Object
Handle errors if they exist.
- .handle_warnings(warnings) ⇒ Object
- .print_errors(errors) ⇒ Object
- .print_warnings(warnings) ⇒ Object
Class Method Details
.handle_errors(errors) ⇒ Object
Handle errors if they exist
6 7 8 9 10 11 12 13 |
# File 'lib/renegade/handle_errors.rb', line 6 def self.handle_errors(errors) if errors.empty? true else print_errors(errors) false end end |
.handle_warnings(warnings) ⇒ Object
15 16 17 |
# File 'lib/renegade/handle_errors.rb', line 15 def self.handle_warnings(warnings) print_warnings(warnings) unless warnings.empty? end |
.print_errors(errors) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/renegade/handle_errors.rb', line 19 def self.print_errors(errors) puts "\nErrors:" errors.each do |error| puts "- #{error}" end puts "\n" end |
.print_warnings(warnings) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/renegade/handle_errors.rb', line 29 def self.print_warnings(warnings) puts "\nWarnings:" warnings.each do |warning| puts "- #{warning}" end puts "\n" end |