lib/massa/cli.rb in massa-0.1.2 vs lib/massa/cli.rb in massa-0.1.3
- old
+ new
@@ -1,11 +1,13 @@
# frozen_string_literal: true
module Massa
class CLI
class << self
- def colorize(color, string)
- puts "\n\e[#{code(color)}m#{string}\e[0m\n"
+ def colorize(*args)
+ print "\n"
+ args.each_slice(2) { |color, string| print "\e[#{code(color)}m#{string}\e[0m" }
+ print "\n"
end
def code(color)
{ red: 31, green: 32, yellow: 33, blue: 34, pink: 35, light_blue: 36 }[color] || 0
end