Method: Cucumber::Ast::Table#hashes

Defined in:
lib/cucumber/ast/table.rb

#hashesObject

Converts this table into an Array of Hash where the keys of each Hash are the headers in the table. For example, a Table built from the following plain text:

| a | b | sum |
| 2 | 3 | 5   |
| 7 | 9 | 16  |

Gets converted into the following:

[{'a' => '2', 'b' => '3', 'sum' => '5'}, {'a' => '7', 'b' => '9', 'sum' => '16'}]

Use #map_column! to specify how values in a column are converted.



125
126
127
128
129
# File 'lib/cucumber/ast/table.rb', line 125

def hashes
  @hashes ||= cells_rows[1..-1].map do |row|
    row.to_hash
  end
end