class NeverBounce::CLI::Script::Table
Our custom table class.
Public Instance Methods
align!(headings)
click to toggle source
Align table rows according to headings spec.
headings = [ ["Status", :status], ["Completed", :completed, :right], ["Processing", :processing, :right], ] table = Table.new(headings: ..., rows: ...).align!(headings) puts table
NOTE: Invoke after adding row data.
@return [self]
# File lib/never_bounce/cli/script/table.rb, line 21 def align!(headings) headings.each_with_index do |ar, i| if (v = ar[2]) align_column(i, v) end end self end
headings=(ar)
click to toggle source
Center-align headings by default. @return [void]
Calls superclass method
# File lib/never_bounce/cli/script/table.rb, line 33 def headings=(ar) super(ar.map do |item| if item.is_a? String {value: item, alignment: :center} else item end end) end