From 304c130fa9649f2ec9910ddf46ba20e4daf4ec47 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Thu, 30 Apr 2026 10:31:37 +0200 Subject: [PATCH] Replace module C with COLORS hash Co-Authored-By: Claude Sonnet 4.6 --- bbs.rb | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/bbs.rb b/bbs.rb index 28120df..aa5b141 100644 --- a/bbs.rb +++ b/bbs.rb @@ -12,20 +12,14 @@ MESSAGES = MessageBoardRepository.new(ENV.fetch('MESSAGES_PATH', 'data/messages. WIKI = WikiRepository.new(token: ENV['WEBAPP_WIKIJS_TOKEN']) CATALOG = CatalogRepository.new -module C - RESET = "\e[0m" - GRAY = "\e[0;37m" - YELLOW = "\e[0;33m" - WHITE = "\e[1;37m" - BLUE = "\e[0;34m" - CYAN = "\e[0;36m" - GREEN = "\e[1;32m" - MAGENTA = "\e[0;35m" - RED = "\e[1;31m" -end +COLORS = { + reset: "\e[0m", gray: "\e[0;37m", yellow: "\e[0;33m", + white: "\e[1;37m", blue: "\e[0;34m", cyan: "\e[0;36m", + green: "\e[1;32m", magenta: "\e[0;35m", red: "\e[1;31m" +}.freeze def c(color, text) - "#{C.const_get(color.to_s.upcase)}#{text}#{C::RESET}" + "#{COLORS.fetch(color)}#{text}#{COLORS[:reset]}" end class OutputBuilder @@ -58,7 +52,7 @@ class OutputBuilder private - def c(color, text) = "#{C.const_get(color.to_s.upcase)}#{text}#{C::RESET}" + def c(color, text) = "#{COLORS.fetch(color)}#{text}#{COLORS[:reset]}" def flush_badges return if @badges.empty?