Sha256: 411c602791079079f2159905ef6db943ed80c41f78212edaf770e014697ac7a4
Contents?: true
Size: 646 Bytes
Versions: 4
Compression:
Stored size: 646 Bytes
Contents
class Report class Head attr_reader :table def initialize(table) @table = table @rows = [] end def row(*cells) @rows << cells end def each(report) @rows.each do |row| actual = row.map do |cell| case cell when String cell when Symbol unless report.respond_to?(cell) raise "#{report.inspect} doesn't respond to #{cell.inspect}" end report.send cell else raise "must pass String or Symbol to head row" end end yield actual end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
report-0.1.1 | lib/report/head.rb |
report-0.1.0 | lib/report/head.rb |
report-0.0.3 | lib/report/head.rb |
report-0.0.2 | lib/report/head.rb |