Class: Slk::Formatters::AttachmentFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/slk/formatters/attachment_formatter.rb

Overview

Formats Slack message attachments for terminal display

Instance Method Summary collapse

Constructor Details

#initialize(output:, text_processor:) ⇒ AttachmentFormatter

Returns a new instance of AttachmentFormatter.



7
8
9
10
# File 'lib/slk/formatters/attachment_formatter.rb', line 7

def initialize(output:, text_processor:)
  @output = output
  @text_processor = text_processor
end

Instance Method Details

#format(attachments, lines, options, message_ts: nil) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/slk/formatters/attachment_formatter.rb', line 12

def format(attachments, lines, options, message_ts: nil)
  return if attachments.empty?
  return if options[:no_attachments]

  attachments.each_with_index do |att, idx|
    format_attachment(att, lines, options, message_ts: message_ts, index: idx)
  end
end