lib/cucumber/multiline_argument/data_table.rb in cucumber-3.0.0.pre.2 vs lib/cucumber/multiline_argument/data_table.rb in cucumber-3.0.0

- old
+ new

@@ -80,11 +80,11 @@ # @param data [Core::Ast::DataTable] the data for the table # @param conversion_procs [Hash] see map_columns! # @param header_mappings [Hash] see map_headers! # @param header_conversion_proc [Proc] see map_headers! def initialize(data, conversion_procs = NULL_CONVERSIONS.dup, header_mappings = {}, header_conversion_proc = nil) - raise ArgumentError, 'data must be a Core::Ast::DataTable' unless data.kind_of? Core::Ast::DataTable + raise ArgumentError, 'data must be a Core::Ast::DataTable' unless data.is_a? Core::Ast::DataTable ast_table = data # Verify that it's square ast_table.transpose @cell_matrix = create_cell_matrix(ast_table) @conversion_procs = conversion_procs @@ -157,11 +157,13 @@ # Gets converted into the following: # # [{:foo => '2', :bar => '3', :foo_bar => '5'}, {:foo => '7', :bar => '9', :foo_bar => '16'}] # def symbolic_hashes - @header_conversion_proc = lambda { |h| symbolize_key(h) } - @symbolic_hashes ||= build_hashes + @symbolic_hashes ||= + self.hashes.map do |string_hash| + Hash[string_hash.map{ |a,b| [symbolize_key(a), b] }] + end end # Converts this table into a Hash where the first column is # used as keys and the second column is used as values #