Use snake_case for variables
parent
6a13a0eee6
commit
162d433014
|
@ -215,16 +215,16 @@ class Table
|
||||||
#
|
#
|
||||||
# Returns new sub-table with headers and rows maching column names submitted
|
# Returns new sub-table with headers and rows maching column names submitted
|
||||||
#
|
#
|
||||||
def [](*colnames)
|
def [](*col_names)
|
||||||
tbl = self.class.new('Indent' => self.indent,'Header' => self.header,'Columns' => colnames)
|
tbl = self.class.new('Indent' => self.indent,'Header' => self.header,'Columns' => col_names)
|
||||||
idx = []
|
idx = []
|
||||||
colnames.each do |colname|
|
col_names.each do |col_name|
|
||||||
idx << self.columns.index(colname)
|
idx << self.columns.index(col_name)
|
||||||
end
|
end
|
||||||
self.rows.each do |oldrow|
|
self.rows.each do |old_row|
|
||||||
newrow = []
|
new_row = []
|
||||||
idx.map {|i| newrow << oldrow[i]}
|
idx.map {|i| new_row << old_row[i]}
|
||||||
tbl << newrow
|
tbl << new_row
|
||||||
end
|
end
|
||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue