lib/pt/data_table.rb in pt-0.5.5 vs lib/pt/data_table.rb in pt-0.5.6
- old
+ new
@@ -8,14 +8,16 @@
def initialize(dataset)
@rows = dataset.map{ |row| DataRow.new(row, dataset) }
end
- def print
+ def print(config={})
if @rows.empty?
- puts "\n -- empty list -- \n"
+ puts "\n#{'-- empty list --'.center(36)}\n"
else
- self.class.table @rows, :fields => [:num] + self.class.fields, :unicode => true, :description => false
+ self.class.table @rows, :fields => [:num] + self.class.fields,
+ :unicode => true, :description => false,
+ :max_width => config[:max_width]
end
end
def [](pos)
pos = pos.to_i