lib/slim_lint/logger.rb in slim_lint-0.2.0 vs lib/slim_lint/logger.rb in slim_lint-0.3.0

- old
+ new

@@ -71,19 +71,10 @@ # @return [nil] def warning(*args) color(33, *args) end - # Print specified output in bold face in a color indicative of a warning. - # If output destination is not a TTY, behaves the same as {#log}. - # - # @param args [Array<String>] - # @return [nil] - def bold_warning(*args) - color('1;33', *args) - end - # Print the specified output in a color indicating information. # If output destination is not a TTY, behaves the same as {#log}. # # @param args [Array<String>] # @return [nil] @@ -98,9 +89,14 @@ @out.respond_to?(:tty?) && @out.tty? end private + # Print output in the specified color. + # + # @param code [Integer,String] ANSI color code + # @param output [String] output to print + # @param newline [Boolean] whether to append a newline def color(code, output, newline = true) log(color_enabled ? "\033[#{code}m#{output}\033[0m" : output, newline) end end end