Module: ReportDataTable
- Included in:
- TDriverReportCreator::TestRun
- Defined in:
- lib/tdriver/report/report_data_table.rb
Instance Method Summary collapse
- #add_data_from_array(data_array_to_add, table_data, table_columns) ⇒ Object
- #add_data_from_hash(data_hash_to_add, table_data, table_columns) ⇒ Object
Instance Method Details
#add_data_from_array(data_array_to_add, table_data, table_columns) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/tdriver/report/report_data_table.rb', line 31 def add_data_from_array(data_array_to_add,table_data,table_columns) raise TypeError.new( 'Input parameter not of Type: Array.\nIt is: ' + data_array_to_add.class.to_s ) unless data_array_to_add.kind_of?( Array ) column=nil data=nil column_found=false value_found=false data_hash=Hash.new data_array_to_add.each do |value| if (column_found) data=value data_found=true end if (!column_found) column=value column_found=true end if (column_found && data_found) if column!=nil && data!=nil data_hash[column]=data table_columns<<column unless table_columns.include?(column) column_found=false data_found=false end end end table_data<<data_hash end |
#add_data_from_hash(data_hash_to_add, table_data, table_columns) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/tdriver/report/report_data_table.rb', line 24 def add_data_from_hash(data_hash_to_add,table_data,table_columns) raise TypeError.new( 'Input parameter not of Type: Hash.\nIt is: ' + data_hash_to_add.class.to_s ) unless data_hash_to_add.kind_of?( Hash ) data_hash_to_add.each_key {|key| table_columns<<key if !table_columns.include?(key)} table_data<<data_hash_to_add end |