Sha256: 4a2aa31126e290a6ccde9789c94acc2ad837811e612824825a5ee49f5c1f3652
Contents?: true
Size: 697 Bytes
Versions: 8
Compression:
Stored size: 697 Bytes
Contents
module Cucumber module Model class Table attr_accessor :raw # Creates a new table. The +raw+ argument should be an array # of arrays def initialize(raw) @raw = raw end # Turn the table into an array of Hash where each Hash # has keys corresponding to the table header (first line) # and the values are the individual row cells. def hashes header = @raw[0] rows.map do |row| h = {} row.each_with_index do |v,n| key = header[n] h[key] = v end h end end def rows @raw[1..-1] end end end end
Version data entries
8 entries across 8 versions & 3 rubygems