module WebReport
WebReport โ Ibis-style IRC cards for !web replies. Public: list, not_found Depends: IrcReply Tests: test/lib/web_report_test.rb
Constants
- TAG
Public Instance Methods
Source
# File lib/web_report.rb, line 34 def format_line(entry) label = entry[:label].to_s url = entry[:url].to_s return "#{label} โ #{url}" if entry[:complete] "#{label} โ #{url} (set web.public_base for full URL)" end
Source
# File lib/web_report.rb, line 15 def list(entries:, bot_id:, key: nil) title = key.to_s.strip.empty? ? "web sites" : "web ยท #{key}" body_lines = Array(entries).map { |entry| format_line(entry) } count = entries.length site_word = count == 1 ? "site" : "sites" footer = ["#{count} #{site_word}", bot_id.to_s] IrcReply.card( tag: TAG, title: title, body_lines: body_lines, footer_parts: footer ) end
Source
# File lib/web_report.rb, line 30 def not_found(key) IrcReply.error(tag: TAG, message: "No site #{key}.") end