Sha256: 559ff3a08d32f14b839832f940c59918c46a6188b0250bbd4bfdaddd641709a4

Contents?: true

Size: 774 Bytes

Versions: 10

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

require 'terminal-table'

module CycloneLariat
  module Presenters
    class Topics
      HEADS = %w[valid region account_id name instance kind publisher type fifo].freeze

      def self.call(topics)
        new.call(topics)
      end

      def call(topics)
        rows = []
        topics.each do |topic|
          rows << row(topic)
        end

        Terminal::Table.new rows: rows, headings: HEADS
      end

      private

      def row(topic)
        [
          topic.custom? ? 'custom' : 'standard',
          topic.region,
          topic.account_id,
          topic.name,
          topic.instance,
          topic.kind,
          topic.publisher,
          topic.type,
          topic.fifo
        ]
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cyclone_lariat-1.0.0 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc9 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc8 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc7 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc6 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc5 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc4 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc3 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc2 lib/cyclone_lariat/presenters/topics.rb
cyclone_lariat-1.0.0.rc1 lib/cyclone_lariat/presenters/topics.rb