Sha256: f0c65690a72985fed43a1742ee5ca46e224e399c0b0dc65d652e7fa34b6d029c
Contents?: true
Size: 538 Bytes
Versions: 1
Compression:
Stored size: 538 Bytes
Contents
module ValidData class Printer #TODO: Auto-scale padding as a function of the longest name being printed. def initialize(padding) @padding = padding puts header end def print(result) "%s | %s | %s" % [result.name, result.invalid_count, result.total].map{ |cell| cell.to_s.ljust(padding) } end def header "%s | %s | %s" % ["Model", "Invalid", "Total"].map{ |title| title.ljust(padding) } + "\n" + "-" * 3 * padding end private attr_reader :result, :padding end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
valid_data-0.0.1 | lib/valid_data/printer.rb |