Sha256: ba7d00c34893ccd76770e37131dd54b3b4a0cf7a5c07d279802e08f0e0f35ffd
Contents?: true
Size: 627 Bytes
Versions: 1
Compression:
Stored size: 627 Bytes
Contents
require 'report/body/column' require 'report/body/row' require 'report/body/rows' class Report class Body attr_reader :table attr_reader :columns def initialize(table, &blk) @table = table @columns = [] instance_eval(&blk) end def rows(*args) @rows = Rows.new(*([self]+args)) end def column(*args, &blk) @columns << Column.new(*([self]+args), &blk) end def each(report) @rows.each(report) do |obj| yield Row.new(self, obj) end end def to_a(report) a = [] each(report) { |row| a << row.to_a } a end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
report-0.0.1 | lib/report/body.rb |