Sha256: e282951199310e57569cd1293da61e3712e8fffcf6944f75d39d8ad6c195a908

Contents?: true

Size: 746 Bytes

Versions: 47

Compression:

Stored size: 746 Bytes

Contents

require 'table_print'
require 'ostruct'

module PactBroker
  module Client
    module Environments
      class TextFormatter

        def self.call(environments)
          return "" if environments.size == 0

          data = environments.collect do | environment |
            OpenStruct.new(environment)
          end.sort_by{ | environment | environment.name.downcase }

          uuid_width = data.collect(&:uuid).collect(&:size).max

          tp_options = [
            { uuid: { width: uuid_width } },
            { name: {} },
            { displayName: { display_name: "Display name" } },
            { production: {} }
          ]

          TablePrint::Printer.new(data, tp_options).table_print
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
pact_broker-client-1.77.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.76.2 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.76.1 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.76.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.75.4 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.75.3 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.75.1 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.75.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.74.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.73.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.72.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.71.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.70.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.69.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.68.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.67.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.66.1 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.66.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.65.0 lib/pact_broker/client/environments/text_formatter.rb
pact_broker-client-1.64.0 lib/pact_broker/client/environments/text_formatter.rb