Sha256: 14b805595c72e9cde7ff8261103f05803bbdbd9b61d11e08c88c9e9134116be5

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

# encoding: utf-8

module GithubCLI
  module Formatters
    class Table

      def initialize(response)
        @response = response
      end

      def format
        case @response
        when Array
          @response.each do |item|
            render_vertical item
            $stdout.puts
          end
        else
          render_vertical @response
        end
      end

      def render_vertical(item)
        output = {}
        GithubCLI::Util.flatten_hash(item.to_hash, output)
        GithubCLI.ui.print_table(
          output.keys.zip(GithubCLI::Util.convert_values(output.values))
        )
      end

      def render_horizontal
      end

    end # Table
  end # Formatters
end # GithubCLI

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github_cli-0.3.1 lib/github_cli/formatters/table.rb
github_cli-0.3.0 lib/github_cli/formatters/table.rb