Class: Ace::Hitl::Molecules::HitlDisplayFormatter
- Inherits:
-
Object
- Object
- Ace::Hitl::Molecules::HitlDisplayFormatter
- Defined in:
- lib/ace/hitl/molecules/hitl_display_formatter.rb
Overview
Formats HITL events for list output with stats footer.
Constant Summary collapse
- C =
Ace::Support::Items::Atoms::AnsiColors
- STATUS_SYMBOLS =
{ "pending" => "○", "answered" => "✓" }.freeze
- STATUS_ORDER =
%w[pending answered].freeze
Class Method Summary collapse
Class Method Details
.format_list(events, total_count: nil, global_folder_stats: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ace/hitl/molecules/hitl_display_formatter.rb', line 17 def self.format_list(events, total_count: nil, global_folder_stats: nil) body = if events.empty? "No HITL events found" else events.sort_by(&:id).map { |event| format_list_line(event) }.join("\n") end stats = Ace::Support::Items::Atoms::ItemStatistics.count_by(events, :status) folder_stats = Ace::Support::Items::Atoms::ItemStatistics.count_by(events, :special_folder) = Ace::Support::Items::Atoms::StatsLineFormatter.format( label: "HITL Events", stats: stats, status_order: STATUS_ORDER, status_icons: STATUS_SYMBOLS, folder_stats: folder_stats, total_count: total_count, global_folder_stats: global_folder_stats ) "#{body}\n\n#{}" end |