| Age | Commit message (Collapse) | Author |
|
Fix Lint/UnusedBlockArgument offenses
|
|
Use `each_value` instead of `each` where possible. The performance gain
is minimal (3%).
```
Comparison:
each_value: 4105733.4 i/s
each: 3998011.4 i/s - 1.03x (± 0.00) slower
```
|
|
Caxlsx is using both `.` and `::`, 220 occurrences vs 280 to invoke
methods on `Axlsx` module.
This commit standardizes the approach towards `.`, which will also allow
shorter lines.
Performance is not affected
```
Comparison:
Axlsx.validate: 8515252.3 i/s
Axlsx::validate: 8512863.7 i/s - same-ish: difference falls within error
```
|
|
This commit fixes cases that cannot be detected by RuboCop
Ref: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
|
|
`%` is an operation on `String` that will return a new `String`, so
the interpolation is redundant
Also adds a missing spec on PivotTable#rels_pn
```
IPS:
uninterpolated: 4045715.7 i/s
interpolated: 2359775.6 i/s - 1.71x (± 0.00) slower
Memory:
uninterpolated: 160 allocated
interpolated: 232 allocated - 1.45x more
```
|
|
- Style/ParenthesesAroundCondition
- Style/RedundantParentheses
- Style/TernaryParentheses
`Style/ParenthesesAroundCondition` may be questionable, but a majority
of comparison where not using parentheses, so offenses have been fixed
for uniformity across the codebase
|
|
|
|
Setter methods return the assigned value. Given:
```rb
class MyClass
def foo=(v)
v = 10
42
end
end
```
`my_object.foo = 5` will always return `5`
This methods removes code that does not have effect
|
|
Currently, there are lots of examples of code like this,
```
str << ('<tag ' << foo << ' ' << bar << '/>')
```
which create the string for the tag in memory before piping to str.
We can avoid creating all of these intermediate strings by dropping
the paranthesis and piping directly to str.
This relies on the `str` passed around to handle lots of small
appends. This is a problem when using RubyZip, but that is solved
in the next commit.
|
|
|
|
|
|
- Layout/SpaceAfterComma
- Layout/SpaceAroundEqualsInParameterDefault
- Layout/SpaceAroundOperators
- Layout/SpaceBeforeBlockBraces
- Layout/SpaceInsideBlockBraces
- Layout/SpaceInsideHashLiteralBraces
- Layout/SpaceInsideParens
|
|
|
|
```
rubocop --only Layout/EmptyLines -a
```
|
|
```
rubocop --only Style/Encoding -a
```
|
|
Excel will crash unless both `colFields` and `colItems` are declared in the PivotTable xml.
First `field` of `colFields` needs to be set to -2 to tell Excel that the value columns comes from individual columns and not groups.
I do not know why `colItems` are needed, but when set, the Excel document opens without crashing.
|
|
|
|
|
|
|
|
|
|
|
|
instead of axisCol
|
|
|
|
Do not create huge strings
Let Row inherit from SimpleTypedList
Optimized sanitizing
Optimized validation
And more..
|
|
|
|
|
|
|
|
|
|
Relationship instances now keep track of their own id – this should be much more reliable than the old way of more or less “guessing” the relationship id based on the position of some object in some array. Fixes https://github.com/randym/axlsx/issues/212, especially.
Each relationship now has its own, unique id – except for the cases when it doesn’t: Some relationships need to share the same id, see `Relation#should_use_same_id_as?` for the gory details.
All tests pass, and the full example.xlsx is generated without errors and looks fine in Excel for Mac 2011.
The pivot table example still has the problems mentioned in https://github.com/randym/axlsx/issues/168 – but as far as I can tell I didn’t make it worse (Excel is still be able to “repair” the file, and the repaired file then contains the pivot table).
|
|
|
|
|
|
|
|
name in Pivot Table Cache Definition
|
|
|
|
|
|
worksheet#outline_rows
worksheet#outline_columns
|
|
see examples/pivot_table.rb
wb.add_worksheet(:name => "Data Sheet") do |sheet|
sheet.add_row ['Month', 'Year', 'Type', 'Sales', 'Region']
30.times { sheet.add_row [month, year, type, sales, region] }
sheet.add_pivot_table 'G4:L17', "A1:E31" do |pivot_table|
pivot_table.rows = ['Month', 'Year']
pivot_table.columns = ['Type']
pivot_table.data = ['Sales']
pivot_table.pages = ['Region']
end
end
|
|
* an example can be run with `ruby examples/pivot_table.rb`
* right now you cannot set options on the pivot table to make it useful (coming soon...)
|