Sha256: 10248bc27fc91af2613efa71ece0ebfa94a2e959b6a82d5029d0e25e891800c2

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

require 'terminal-table'

module Buildpack
  module Packager
    class DefaultVersionsPresenter < Struct.new(:default_versions)
      include TablePresentation

      attr_reader :default_versions

      def initialize(default_versions)
        default_versions = [] if default_versions.nil?
        @default_versions = default_versions
      end

      def inspect
        table = Terminal::Table.new do |table|
          default_versions.sort_by do |dependency|
            sort_string_for dependency
          end.each do |dependency|
            columns = [
              dependency['name'],
              sanitize_version_string(dependency['version'])
            ]
            table.add_row columns
          end
        end

        table.headings = %w(name version)

        table.to_s
      end

      def present
        to_markdown(inspect)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buildpack-packager-2.3.4 lib/buildpack/packager/default_versions_presenter.rb