Class: Cucumber::Ast::Table
- Inherits:
-
Object
- Object
- Cucumber::Ast::Table
- Defined in:
- lib/cucumber_tricks/table_extensions.rb
Instance Method Summary collapse
Instance Method Details
#hash_2_lists ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/cucumber_tricks/table_extensions.rb', line 11 def hash_2_lists result = {} raw.each do |row| raise StandardError.new("hash_2_lists tables must have a '=>' in the second column") unless row.size == 1 or row[1] == '=>' result[row[0]] = row.drop(2).reject &:empty? end result end |
#hashes_with_defaults(main_column, defaults = {}) ⇒ Object
5 6 7 8 9 |
# File 'lib/cucumber_tricks/table_extensions.rb', line 5 def hashes_with_defaults(main_column, defaults = {}) hashes_with_default_column(main_column).map do |hash| defaults.merge(hash) end end |