module AurReport
Constants
- FOOTER
- TAG
Public Instance Methods
Source
# File lib/aur_report.rb, line 74 def build_fetch_error(query) SearchReport.fetch_error_card( tag: TAG, query: query, fallback_title: "package search", error_lines: [ "AUR search unavailable right now.", "Try: #{AurSearch.browse_url(query)}" ], footer_parts: FOOTER ) end
Source
# File lib/aur_report.rb, line 38 def build_report(query:, total:, items:) if items.empty? return SearchReport.empty_report( tag: TAG, query: query, total: 0, empty_lines: [ "No AUR matches for that keyword.", "Browse: #{AurSearch.browse_url(query)}" ], footer_parts: FOOTER ) end extra = total - items.length body_lines = items.each_with_index.map { |item, index| format_item_line(index + 1, item) } body_lines << "... #{TextUtil.format_count(extra)} more on AUR" if extra.positive? SearchReport.results_report( tag: TAG, query: query, total: total, body_lines: body_lines, footer_parts: FOOTER ) end
Source
# File lib/aur_report.rb, line 65 def build_usage SearchReport.usage_card( tag: TAG, title: "package search", usage_message: AurSearch.usage_message, footer_parts: FOOTER ) end
Source
# File lib/aur_report.rb, line 23 def format_item_line(index, item) meta = [item[:version]] meta << format_votes(item[:votes]) if item.key?(:votes) meta << item[:maintainer].to_s.strip unless item[:maintainer].to_s.strip.empty? meta << "out of date" if item[:out_of_date] meta << AurSearch.truncate_text(item[:description]) SearchReport.list_item_line( index: index, title: item[:name], detail_parts: meta.reject(&:empty?), url: item[:url] ) end
Source
# File lib/aur_report.rb, line 18 def format_votes(count) votes = count.to_i "#{votes} vote#{'s' unless votes == 1}" end