README.md in table_transform-0.6.1 vs README.md in table_transform-0.6.2

- old
+ new

@@ -48,14 +48,14 @@ # Rename column r.rename_column('Age', 'Years') # Create a new Table with given column in specified order - t.extract(%w(Length Name)) + t2 = t.extract(%w(Length Name)) - # Filter table - t.filter{|row| row['Age].to_i > 20} + # Filter to a new table + t2 = t.filter{|row| row['Age].to_i > 20} # Adds rows of two tables with same header t1 = TableTransform::Table::create_empty(%w(Col1 Col2)) t2 = TableTransform::Table::create_empty(%w(Col1 Col2)) t3 = t1 + t2 @@ -64,11 +64,12 @@ # Loop through all rows t.each_row{|row| puts row['Rebate'].to_f * row['Price'].to_f} #### Table::Row `Table::each_row` return a `Table::Row`<br/> -A row can access its values by column name e.g. `row['Name']` +A row can access its values by column name e.g. `row['Name']`<br/> +If column name does not exist (case sensitive) an exception is raised #### Table:Cell # Table::Cell < String row['operating_system'].downcase == 'centos' @@ -107,36 +108,36 @@ t.column_properties['Tax'].update({format: '0.0%'}) # Extract properties t.column_properties['Tax'] # {format: '0.0%'} - # Add meta data during add_column + # Add property during add_column t.add_column('Tax', {format: '0.0%'}){|row| 0.25} ### Formula Formulas can be added to columns. They have to be in US locale. Column values will be nil if inspected # Add formula to column t.add_column_formula('OnePlusOne', '1+1') # Add formula to column with meta data - t.add_column_formula('OnePlusOne', '1+1' {format: '0.0'}) + t.add_column_formula('OnePlusOne', '1+1', {format: '0.0'}) #### Formula helper To aid when creating formulas there are a few helpers available f = TableTransform::FormulaHelper # Namespace alias # Column - f::column('price') # <=> [price] - t.add_column_formula('Total value', "#{f::column('price')}*f::column('volume')}") + f::column('price') # <=> '[price]' + t.add_column_formula('Total value', "#{f::column('price')} * #{f::column('volume')}") # Table - f::table('Table1') # <=> Table1[] + f::table('Table1') # <=> 'Table1[]' # Text (will avoid the clutter of protecting " character) - f::text('No') # <=> "No" + f::text('No') # <=> '"No"' # VLOOKUP, convenience function to extract values from another table # Finds the street name in table Address for name specified in column Name f::vlookup(f::column('Name'), 'Address', 'Street')) f::vlookup('[Name]', 'Address', 'Street'))