module RaspbergAddressReport
RaspbergAddressReport โ IRC cards for address book replies.
Constants
- SOURCE
- TAG
Public Instance Methods
Source
# File lib/raspberg_address_report.rb, line 45 def format_added(contact) format_contact(contact) end
Source
# File lib/raspberg_address_report.rb, line 13 def format_contact(contact) IrcReply.card( tag: TAG, title: "Address Book", body_lines: [ "Name โ #{contact['name']}", "Phone โ #{contact['phone']}", contact["address"].to_s ], footer_parts: ["stored per nick", SOURCE] ) end
Source
# File lib/raspberg_address_report.rb, line 49 def format_deleted(contact) IrcReply.card( tag: TAG, title: "Address Book", body_lines: ["Removed #{contact['name']}."], footer_parts: [SOURCE] ) end
Source
# File lib/raspberg_address_report.rb, line 26 def format_list(contacts:) if contacts.empty? return IrcReply.card( tag: TAG, title: "Address Book", body_lines: ["No contacts found."], footer_parts: [SOURCE] ) end body_lines = contacts.map { |c| "#{c['name']} ยท #{c['phone']}" } IrcReply.card( tag: TAG, title: "Address Book", body_lines: body_lines, footer_parts: ["#{contacts.length} contact(s)", SOURCE] ) end