Sha256: 761613348e8229b2357a5c7e2e779dd66a68cad6384474d3c79ef28cb7d7c6b3
Contents?: true
Size: 501 Bytes
Versions: 2
Compression:
Stored size: 501 Bytes
Contents
module ForEachRow # Example: # for_each_row <<-TABLE do |number1, number2, sum| # |1, 2, 3 | # |5, 7, 12 | # TABLE # (number2 + number2).should == sum # end def for_each_row(table, &block) table.split("\n").each do |row| if row.strip =~ /^\|(.*)\|$/ cell_values = $1.split(",").map { |cell| eval(cell, block) } block.call *cell_values end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
Peeja-for_each_row-0.0.0 | lib/for_each_row.rb |
for_each_row-0.0.0 | lib/for_each_row.rb |