class StyleStats::Template::Table
Public Class Methods
new(hash)
click to toggle source
# File lib/style_stats/templates/table.rb, line 5 def initialize(hash) @hash = hash end
Public Instance Methods
run()
click to toggle source
# File lib/style_stats/templates/table.rb, line 9 def run table(width: :auto, border: true) do @hash.each do |key, value| if value.is_a?(Array) value.each_with_index do |item, index| row(separate: index == value.count - 1) do column(index.zero? ? key : '', color: :red) column(item) end end else row do column(key, color: :red) column(value) end end end end end