lib/coveralls/output.rb in coveralls_reborn-0.13.0 vs lib/coveralls/output.rb in coveralls_reborn-0.13.1
- old
+ new
@@ -63,14 +63,17 @@
# # => "\e[36mHello World\e[0m"
#
# Returns the formatted string.
def format(string, options = {})
unless no_color?
- require 'term/ansicolor'
- options[:color]&.split(/\s/)&.reverse_each do |color|
- next unless Term::ANSIColor.respond_to?(color.to_sym)
+ begin
+ require 'term/ansicolor'
+ options[:color]&.split(/\s/)&.reverse_each do |color|
+ next unless Term::ANSIColor.respond_to?(color.to_sym)
- string = Term::ANSIColor.send(color.to_sym, string)
+ string = Term::ANSIColor.send(color.to_sym, string)
+ end
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
end
end
string
end