README.md in table_transform-0.5.0 vs README.md in table_transform-0.6.0
- old
+ new
@@ -44,10 +44,13 @@
t.change_column('Age'){|row| row['Age'].to_i}
# Will remove given columns. One or several can be specified.
t.delete_column('Name', 'Address')
+ # Rename column
+ r.rename_column('Age', 'Years')
+
# Create a new Table with given column in specified order
t.extract(%w(Length Name))
# Filter table
t.filter{|row| row['Age].to_i > 20}
@@ -71,25 +74,41 @@
# include_any?
c = row['Col1'] # c = 'CHECK'
c.include_any?(%w(AA EC DD))) # true
-### Table properties
+### Properties
+There are two categories of properties, Table and Column<br/>
+Same interface for interacting with properties
+
+ # Update - add or update :name property in existing p
+ p.update({name: 'xxx'})
+
+ # Reset - resets p with given property, clearing previous properties
+ p.reset({name: 'xxx'})
+
+ # Delete
+ p.delete(:name)
+
+ # Each
+ p.each{|x| ...}
+
+ # Access
+ p[:name]
+
+#### Table properties
# Set table name - override default name
t.table_properties.update({name: 'Table1'})
# Set turn on/off auto filter button
t.table_properties.update({auto_filter: false})
-### Meta data
+#### Column properties
# Set format for one column
- t.set_metadata('Tax', {format: '0.0%'})
+ t.column_properties['Tax'].update({format: '0.0%'})
- # Extract metadata
- t.metadata['Tax'] # {format: '0.0%'}
-
- # Set format for multiple columns
- t.set_metadata(*%w(Income Tax Dept), {format: '#,##0'})
+ # Extract properties
+ t.column_properties['Tax'] # {format: '0.0%'}
# Add meta data during add_column
t.add_column('Tax', {format: '0.0%'}){|row| 0.25}
### Formula