Method: Array#table_line
- Defined in:
- lib/array/formatter.rb
#table_line(position) ⇒ Object
table_line position
generate a table line for position (:top, :middle, :bottom)
234 235 236 237 238 239 240 241 242 243 |
# File 'lib/array/formatter.rb', line 234 def table_line(position) c = @chars left, line, mid, right = case position when :top then [c[:tlb], c[:tb], c[:tib], c[:trb]] when :middle then [c[:lib], c[:ib], c[:mib], c[:rib]] when :bottom then [c[:blb], c[:bb], c[:bib], c[:brb]] end s = @chars.wrap(left + @widths.map{|w| line * (w + 2)}.join(mid) + right) + "\n" s end |