File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,23 @@ def add_hr
221
221
#
222
222
# Returns new sub-table with headers and rows maching column names submitted
223
223
#
224
+ #
225
+ # Flips table 90 degrees left
226
+ #
227
+ def drop_left
228
+ tbl = self . class . new (
229
+ 'Columns' => Array . new ( self . rows . count +1 , ' ' ) ,
230
+ 'Header' => self . header ,
231
+ 'Indent' => self . indent )
232
+ ( self . columns . count +1 ) . times do |ti |
233
+ row = self . rows . map { |r | r [ ti ] } . unshift ( self . columns [ ti ] ) . flatten
234
+ # insert our col|row break. kind of hackish
235
+ row [ 1 ] = "| #{ row [ 1 ] } " unless row . all? { |e | e . nil? || e . empty? }
236
+ tbl << row
237
+ end
238
+ return tbl
239
+ end
240
+
224
241
def []( *col_names )
225
242
tbl = self . class . new ( 'Indent' => self . indent ,
226
243
'Header' => self . header ,
You can’t perform that action at this time.
0 commit comments