Sha256: 05b6c24e9d32b4f1a94e83625bc904ce7725c6212c8739be7da622b046d27ab5

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2024 Eric Crane.  All rights reserved.
#
# CLI input.
#
require 'colorize'
require 'terminal-table'

module Gloo
  module App
    class Table

      #
      # Set up Table Helper.
      #
      def initialize platform
        @platform = platform
      end

      # 
      # Put a box around the given string.
      def box( str_value )
        puts str_value
        box = Terminal::Table.new( :headings => [], :rows => [ [ str_value ] ] )
        return box.to_s
      end

      #
      # Show the given table data.
      #
      def show( headers, data, title = nil )
        unless title.blank?
          table = Terminal::Table.new( 
            :title => title, :headings => headers, :rows => data )
        else
          table = Terminal::Table.new( :headings => headers, :rows => data )
        end
        puts table.to_s.colorize( color: :white, background: :black )
      end

      
      # ---------------------------------------------------------------------
      #    Private Functions
      # ---------------------------------------------------------------------

      private


    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gloo-3.8.0 lib/gloo/app/table.rb
gloo-3.7.0 lib/gloo/app/table.rb
gloo-3.6.2 lib/gloo/app/table.rb
gloo-3.6.1 lib/gloo/app/table.rb
gloo-3.6.0 lib/gloo/app/table.rb
gloo-3.5.0 lib/gloo/app/table.rb
gloo-3.4.1 lib/gloo/app/table.rb
gloo-3.4.0 lib/gloo/app/table.rb