Replace module C with COLORS hash

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 10:31:37 +02:00
parent ac77420888
commit 304c130fa9

20
bbs.rb
View File

@@ -12,20 +12,14 @@ MESSAGES = MessageBoardRepository.new(ENV.fetch('MESSAGES_PATH', 'data/messages.
WIKI = WikiRepository.new(token: ENV['WEBAPP_WIKIJS_TOKEN']) WIKI = WikiRepository.new(token: ENV['WEBAPP_WIKIJS_TOKEN'])
CATALOG = CatalogRepository.new CATALOG = CatalogRepository.new
module C COLORS = {
RESET = "\e[0m" reset: "\e[0m", gray: "\e[0;37m", yellow: "\e[0;33m",
GRAY = "\e[0;37m" white: "\e[1;37m", blue: "\e[0;34m", cyan: "\e[0;36m",
YELLOW = "\e[0;33m" green: "\e[1;32m", magenta: "\e[0;35m", red: "\e[1;31m"
WHITE = "\e[1;37m" }.freeze
BLUE = "\e[0;34m"
CYAN = "\e[0;36m"
GREEN = "\e[1;32m"
MAGENTA = "\e[0;35m"
RED = "\e[1;31m"
end
def c(color, text) def c(color, text)
"#{C.const_get(color.to_s.upcase)}#{text}#{C::RESET}" "#{COLORS.fetch(color)}#{text}#{COLORS[:reset]}"
end end
class OutputBuilder class OutputBuilder
@@ -58,7 +52,7 @@ class OutputBuilder
private 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 def flush_badges
return if @badges.empty? return if @badges.empty?