Sha256: 8ee0baf865cf2246df9acc70421164cabe806ee1407c9d75e4e2b5d8418f2406
Contents?: true
Size: 1.32 KB
Versions: 13
Compression:
Stored size: 1.32 KB
Contents
require 'command_line_reporter' # Context module Contexto # Display class class Display include CommandLineReporter def initialize @header = '** Contexto Contextualizes **' puts "\n" header title: @header, width: 80, align: 'center', rule: true, color: 'green', bold: true end def create_display(title, headings, rows) @title = title @headings = headings @rows = rows create_new_table end def create_new_table if @title header title: @title, width: 50, align: 'left', color: 'red', bold: true end table(border: true) do row header: true do @headings.each do |h| column(h, headings_options) end end @rows.each do |r| row do r.each do |rr| column(rr, row_options) end end end end end def headings_options { align: 'center', width: col_width } end def row_options { align: 'center', width: col_width, color: 'green' } end def col_width @col_width ||= @rows.map(&:size).max + 10 end end end
Version data entries
13 entries across 13 versions & 1 rubygems