Sha256: d9aac91e13d458de7eb88651b60673d834dc7fb596d0b5de686b591766965010
Contents?: true
Size: 601 Bytes
Versions: 1
Compression:
Stored size: 601 Bytes
Contents
class Row < Array @@cols = [] def << parm arg = parm.to_s if(@@cols[size]) @@cols[size] = arg.size if arg.size > @@cols[size] else @@cols[size] = arg.size end super arg end def to_s str = String.new self.each_with_index do |cell,i| str << cell + (' ' * (@@cols[i] - cell.size + 1)) end str + "\n" end end class Table def initialize @rows = [] end def << arg row = Row.new @rows << row row << arg end def to_s str = String.new @rows.each do |row| str << row.to_s end str end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alu0101042305-0.1.1 | lib/alu0101042305/table.rb |