caxlsx_builder 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7f55e5374c1b6885ba909895a7fc50f7e72f616fd7a638d0f4f29fcb0a31878
4
- data.tar.gz: 172d36f695c8696b75941a367e1c701f9d932b0caa7096d7a7b59d056b46eb59
3
+ metadata.gz: 99c1449eab24e473b70cfb60c6fb9ffb8750bcfd3331bd4e1bc4d11fa172c5ea
4
+ data.tar.gz: d5a2146247674eb9bd7abb422a0e5635997759ec205619e1518a6e322af1c535
5
5
  SHA512:
6
- metadata.gz: 91e118af40307fc9a773de738d7e817224862f1c322bdd6da6104707933bdffa68c8482620622720cd95cbdae1666eb3ded961876c6ba5d12faf8c357a31c63d
7
- data.tar.gz: 1e7e7cc95bd3ef4bcb21059c8e53d91bb26dd47195387632df11f4c5ddb59c00a97eed9db303b1553bafcd866e094240489b5aa2e8ec886ae8bbf574b6a24b3d
6
+ metadata.gz: 6018bbabd3db00124d3657aee635c6c082c313d321c38345b6322e9ebad534318b73331f897508b1b2863a9933e50ae3b70d1cc2ef0f83783815411f1502c1c3
7
+ data.tar.gz: 0fe4e1c53f7d85a28cb00e7804f77310971d8fae32994a84a590de651283d20f45b32601bb11be2ef252c930fe55cbfef5945582ef995f4c5519295cf9e8d48b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.1.1] - 2022-12-26
2
+
3
+ - Fix 'rescue_errors' option
4
+
1
5
  ## [1.1.0] - 2022-12-26
2
6
 
3
7
  - Allow to rescue errors when calling procs to generate cell, style, type or footer
@@ -125,20 +125,24 @@ module CaxlsxBuilder
125
125
 
126
126
  footer = sheet.footers.map.with_index do |cell, index|
127
127
  if cell.respond_to?(:call)
128
- cell.call(sheet.cells(index))
128
+ call_footer_proc(cell, sheet.cells(index))
129
129
  else
130
130
  cell
131
131
  end
132
- rescue StandardError => e
133
- return nil if @options[:rescue_errors]
134
-
135
- raise e
136
132
  end
137
133
 
138
134
  # Last row is the footer with the footer style applied
139
135
  worksheet.add_row(footer, style: @styles[:footer])
140
136
  end
141
137
 
138
+ def call_footer_proc(cell, cells)
139
+ cell.call(cells)
140
+ rescue StandardError => e
141
+ return nil if @options[:rescue_errors]
142
+
143
+ raise e
144
+ end
145
+
142
146
  # @return [Hash] The options to apply to a cell
143
147
  def cell_options(style: nil, type: nil)
144
148
  style = get_style(style)
@@ -28,11 +28,13 @@ module CaxlsxBuilder
28
28
  def make_row(item, rescue_errors: false)
29
29
  # Build the new row
30
30
  row = @cell_builders.map do |cell|
31
- cell.call(item)
32
- rescue StandardError => e
33
- return nil if rescue_errors
31
+ begin
32
+ cell.call(item)
33
+ rescue StandardError => e
34
+ next nil if rescue_errors
34
35
 
35
- raise e
36
+ raise e
37
+ end
36
38
  end
37
39
 
38
40
  # Add the new row to the cache then return it
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CaxlsxBuilder
4
4
 
5
- VERSION = '1.1.0'
5
+ VERSION = '1.1.1'
6
6
 
7
7
  end
@@ -34,6 +34,8 @@ module CaxlsxBuilder
34
34
 
35
35
  def add_footer_row: (Sheet sheet, Axlsx::Worksheet worksheet) -> void
36
36
 
37
+ def call_footer_proc: (Sheet::footer_proc cell, Array[Sheet::cell_value]? cells) -> Sheet::cell_value?
38
+
37
39
  def cell_options: (style: String? | Symbol?, type: Cell::type_value?) -> { style: Integer, type: Cell::type_value }
38
40
 
39
41
  def cast_to_hash: (Array[{ style: Integer, type: Cell::type_value }] | { style: Array[Integer], types: Array[Cell::type_value] }) -> { style: Array[Integer], types: Array[Cell::type_value] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caxlsx_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu CIAPPARA