module ThemeReport
ThemeReport — Ibis-style IRC cards for !theme replies. Public: help, denial, list, show, active, applied, paint_batch, analyse, generated, saved, error_card Depends: IrcReply, ThemeFrame Tests: test/plugins/theme_test.rb
Constants
- TAG
Public Instance Methods
Source
# File lib/theme_report.rb, line 54 def active(theme_id) body = theme_id ? "Active theme: #{theme_id}" : "No theme set for this channel." IrcReply.card( tag: TAG, title: "active theme", body_lines: [body], footer_parts: ["use !theme use <name> to change"] ) end
Source
# File lib/theme_report.rb, line 86 def analyse(result) AnalyseReport.card(result, tag: TAG) end
Source
# File lib/theme_report.rb, line 64 def applied(theme) IrcReply.card( tag: TAG, title: "#{theme[:name]} applied", body_lines: [ "Active theme set to #{theme[:id]}.", "Paint overrides written for registered sample plugins." ], footer_parts: ["!paint preview blackjack", theme[:width].to_s] ) end
Source
# File lib/theme_report.rb, line 35 def denial IrcReply.error(tag: TAG, message: "Only channel ops and registered admins can use !theme.") end
Source
# File lib/theme_report.rb, line 103 def error_card(message) IrcReply.error(tag: TAG, message: message) end
Source
# File lib/theme_report.rb, line 115 def format_entry(theme, active) marker = theme[:id].to_s == active.to_s ? "*" : "" "#{marker}#{theme[:id]}" end
Source
# File lib/theme_report.rb, line 90 def generated(theme) ThemeFrame.preview(theme) end
Source
# File lib/theme_report.rb, line 17 def help IrcReply.card( tag: TAG, title: "frame themes", body_lines: [ "!theme list — built-in and custom themes", "!theme show <name> — preview doodles and palette", "!theme active — current channel theme", "!theme use <name> — apply theme + paint overrides", "!theme paint <name> [plugin] — copy-paste !paint lines", "!theme analyse [name] — validate paint rules against sample lines", "!theme generate [seed] — procedural new theme preview", "!theme save <name> — persist last generated theme" ], footer_parts: ["admin", "ASCII frame only"] ) end
Source
# File lib/theme_report.rb, line 39 def list(builtin:, custom:, active:) names = builtin.map { |t| format_entry(t, active) } custom.each { |t| names << format_entry(t, active) } IrcReply.card( tag: TAG, title: "available themes", body_lines: [names.join(", ")], footer_parts: ["#{builtin.length + custom.length} themes", active ? "active: #{active}" : "no active theme"] ) end
Source
# File lib/theme_report.rb, line 111 def no_generated_theme error_card("No generated theme to save — run !theme generate first.") end
Source
# File lib/theme_report.rb, line 76 def paint_batch(theme, lines) body = lines.empty? ? "No paint rules for that filter." : lines IrcReply.card( tag: TAG, title: "#{theme[:id]} paint commands", body_lines: Array(body), footer_parts: ["#{Array(body).length} commands", "copy-paste ready"] ) end
Source
# File lib/theme_report.rb, line 94 def saved(name) IrcReply.card( tag: TAG, title: "theme saved", body_lines: ["Custom theme saved as #{name}."], footer_parts: ["!theme use #{name}"] ) end
Source
# File lib/theme_report.rb, line 50 def show(theme) ThemeFrame.preview(theme) end
Source
# File lib/theme_report.rb, line 107 def unknown_theme(name) error_card("Unknown theme #{name} — try !theme list.") end