xlsxrb 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -34
  3. data/README.md +26 -21
  4. data/lib/xlsxrb/chart_builder.rb +18 -18
  5. data/lib/xlsxrb/dsl_helpers.rb +175 -0
  6. data/lib/xlsxrb/elements/cell.rb +56 -22
  7. data/lib/xlsxrb/elements/column.rb +27 -3
  8. data/lib/xlsxrb/elements/row.rb +27 -8
  9. data/lib/xlsxrb/elements/workbook.rb +27 -14
  10. data/lib/xlsxrb/elements/worksheet.rb +17 -1
  11. data/lib/xlsxrb/ooxml/cfb.rb +9 -6
  12. data/lib/xlsxrb/ooxml/crypto/agile.rb +5 -5
  13. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +784 -0
  14. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +3478 -0
  15. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +1796 -0
  16. data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +428 -0
  17. data/lib/xlsxrb/ooxml/reader/listeners.rb +4 -6446
  18. data/lib/xlsxrb/ooxml/shared_strings_parser.rb +3 -5
  19. data/lib/xlsxrb/ooxml/utils.rb +5 -6
  20. data/lib/xlsxrb/ooxml/workbook_writer.rb +5 -7
  21. data/lib/xlsxrb/ooxml/worksheet_parser.rb +172 -9
  22. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +1602 -0
  23. data/lib/xlsxrb/ooxml/writer/features_xml.rb +731 -0
  24. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +348 -0
  25. data/lib/xlsxrb/ooxml/writer.rb +9 -2646
  26. data/lib/xlsxrb/ooxml/xml_builder.rb +31 -2
  27. data/lib/xlsxrb/ooxml/zip_generator.rb +26 -5
  28. data/lib/xlsxrb/ooxml/zip_reader.rb +364 -78
  29. data/lib/xlsxrb/ooxml/zip_writer.rb +32 -5
  30. data/lib/xlsxrb/stream_sheet.rb +94 -6
  31. data/lib/xlsxrb/stream_writer.rb +48 -115
  32. data/lib/xlsxrb/style_builder.rb +10 -1
  33. data/lib/xlsxrb/version.rb +1 -1
  34. data/lib/xlsxrb/workbook_builder.rb +1 -1
  35. data/lib/xlsxrb/worksheet_builder.rb +19 -81
  36. data/lib/xlsxrb.rb +449 -171
  37. data/sig/generated/xlsxrb/chart_builder.rbs +36 -36
  38. data/sig/generated/xlsxrb/dsl_helpers.rbs +92 -0
  39. data/sig/generated/xlsxrb/elements/cell.rbs +29 -0
  40. data/sig/generated/xlsxrb/elements/column.rbs +32 -21
  41. data/sig/generated/xlsxrb/elements/row.rbs +94 -14
  42. data/sig/generated/xlsxrb/elements/workbook.rbs +102 -10
  43. data/sig/generated/xlsxrb/elements/worksheet.rbs +9 -0
  44. data/sig/generated/xlsxrb/ooxml/reader/listeners/core_listeners.rbs +173 -0
  45. data/sig/generated/xlsxrb/ooxml/reader/listeners/drawing_listeners.rbs +400 -0
  46. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +442 -0
  47. data/sig/generated/xlsxrb/ooxml/reader/listeners/style_listeners.rbs +80 -0
  48. data/sig/generated/xlsxrb/ooxml/reader/listeners.rbs +0 -1072
  49. data/sig/generated/xlsxrb/ooxml/shared_strings_parser.rbs +0 -2
  50. data/sig/generated/xlsxrb/ooxml/utils.rbs +2 -0
  51. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +5 -4
  52. data/sig/generated/xlsxrb/ooxml/writer/drawing_xml.rbs +79 -0
  53. data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +83 -0
  54. data/sig/generated/xlsxrb/ooxml/writer/styles_xml.rbs +53 -0
  55. data/sig/generated/xlsxrb/ooxml/writer.rbs +6 -185
  56. data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +18 -0
  57. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +15 -0
  58. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +96 -8
  59. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +5 -1
  60. data/sig/generated/xlsxrb/stream_sheet.rbs +43 -3
  61. data/sig/generated/xlsxrb/style_builder.rbs +7 -0
  62. data/sig/generated/xlsxrb.rbs +18 -11
  63. metadata +22 -144
  64. data/.devcontainer/Dockerfile +0 -65
  65. data/.devcontainer/devcontainer.json +0 -17
  66. data/.gem_rbs_collection/ast/2.4/.rbs_meta.yaml +0 -9
  67. data/.gem_rbs_collection/ast/2.4/ast.rbs +0 -73
  68. data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +0 -9
  69. data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +0 -4
  70. data/.gem_rbs_collection/concurrent-ruby/1.1/atomic_reference.rbs +0 -16
  71. data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +0 -96
  72. data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +0 -4
  73. data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +0 -68
  74. data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +0 -249
  75. data/.gem_rbs_collection/concurrent-ruby/1.1/set.rbs +0 -4
  76. data/.gem_rbs_collection/concurrent-ruby/1.1/timer_task.rbs +0 -47
  77. data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +0 -5
  78. data/.gem_rbs_collection/csv/3.3/.rbs_meta.yaml +0 -9
  79. data/.gem_rbs_collection/csv/3.3/csv.rbs +0 -3871
  80. data/.gem_rbs_collection/csv/3.3/manifest.yaml +0 -3
  81. data/.gem_rbs_collection/lint_roller/1.1/.rbs_meta.yaml +0 -9
  82. data/.gem_rbs_collection/lint_roller/1.1/lint_roller.rbs +0 -48
  83. data/.gem_rbs_collection/listen/3.9/.rbs_meta.yaml +0 -9
  84. data/.gem_rbs_collection/listen/3.9/listen.rbs +0 -25
  85. data/.gem_rbs_collection/listen/3.9/listener.rbs +0 -24
  86. data/.gem_rbs_collection/logger/1.7/.rbs_meta.yaml +0 -9
  87. data/.gem_rbs_collection/logger/1.7/formatter.rbs +0 -45
  88. data/.gem_rbs_collection/logger/1.7/log_device.rbs +0 -100
  89. data/.gem_rbs_collection/logger/1.7/logger.rbs +0 -796
  90. data/.gem_rbs_collection/logger/1.7/manifest.yaml +0 -2
  91. data/.gem_rbs_collection/logger/1.7/period.rbs +0 -17
  92. data/.gem_rbs_collection/logger/1.7/severity.rbs +0 -34
  93. data/.gem_rbs_collection/nokogiri/1.11/.rbs_meta.yaml +0 -9
  94. data/.gem_rbs_collection/nokogiri/1.11/nokogiri.rbs +0 -2332
  95. data/.gem_rbs_collection/nokogiri/1.11/patch.rbs +0 -4
  96. data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +0 -9
  97. data/.gem_rbs_collection/parallel/1.20/parallel.rbs +0 -86
  98. data/.gem_rbs_collection/parser/3.2/.rbs_meta.yaml +0 -9
  99. data/.gem_rbs_collection/parser/3.2/manifest.yaml +0 -7
  100. data/.gem_rbs_collection/parser/3.2/parser.rbs +0 -194
  101. data/.gem_rbs_collection/parser/3.2/polyfill.rbs +0 -4
  102. data/.gem_rbs_collection/rainbow/3.0/.rbs_meta.yaml +0 -9
  103. data/.gem_rbs_collection/rainbow/3.0/global.rbs +0 -7
  104. data/.gem_rbs_collection/rainbow/3.0/presenter.rbs +0 -209
  105. data/.gem_rbs_collection/rainbow/3.0/rainbow.rbs +0 -5
  106. data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +0 -9
  107. data/.gem_rbs_collection/rake/13.0/manifest.yaml +0 -2
  108. data/.gem_rbs_collection/rake/13.0/rake.rbs +0 -39
  109. data/.gem_rbs_collection/regexp_parser/2.8/.rbs_meta.yaml +0 -9
  110. data/.gem_rbs_collection/regexp_parser/2.8/regexp_parser.rbs +0 -17
  111. data/.gem_rbs_collection/rubocop/1.57/.rbs_meta.yaml +0 -9
  112. data/.gem_rbs_collection/rubocop/1.57/rubocop.rbs +0 -208
  113. data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +0 -9
  114. data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +0 -903
  115. data/.gem_rbs_collection/rubyzip/3.2/.rbs_meta.yaml +0 -9
  116. data/.gem_rbs_collection/rubyzip/3.2/manifest.yaml +0 -8
  117. data/.gem_rbs_collection/rubyzip/3.2/zip/central_directory.rbs +0 -42
  118. data/.gem_rbs_collection/rubyzip/3.2/zip/compressor.rbs +0 -5
  119. data/.gem_rbs_collection/rubyzip/3.2/zip/constants.rbs +0 -47
  120. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/aes_encryption.rbs +0 -30
  121. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/decrypted_io.rbs +0 -9
  122. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/encryption.rbs +0 -7
  123. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/null_encryption.rbs +0 -19
  124. data/.gem_rbs_collection/rubyzip/3.2/zip/crypto/traditional_encryption.rbs +0 -31
  125. data/.gem_rbs_collection/rubyzip/3.2/zip/decompressor.rbs +0 -18
  126. data/.gem_rbs_collection/rubyzip/3.2/zip/deflater.rbs +0 -12
  127. data/.gem_rbs_collection/rubyzip/3.2/zip/dirtyable.rbs +0 -11
  128. data/.gem_rbs_collection/rubyzip/3.2/zip/dos_time.rbs +0 -13
  129. data/.gem_rbs_collection/rubyzip/3.2/zip/entry.rbs +0 -95
  130. data/.gem_rbs_collection/rubyzip/3.2/zip/entry_set.rbs +0 -31
  131. data/.gem_rbs_collection/rubyzip/3.2/zip/errors.rbs +0 -58
  132. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/aes.rbs +0 -24
  133. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/generic.rbs +0 -17
  134. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/ntfs.rbs +0 -23
  135. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/old_unix.rbs +0 -22
  136. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/universal_time.rbs +0 -30
  137. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/unix.rbs +0 -20
  138. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/unknown.rbs +0 -15
  139. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field/zip64.rbs +0 -26
  140. data/.gem_rbs_collection/rubyzip/3.2/zip/extra_field.rbs +0 -21
  141. data/.gem_rbs_collection/rubyzip/3.2/zip/file.rbs +0 -131
  142. data/.gem_rbs_collection/rubyzip/3.2/zip/file_split.rbs +0 -14
  143. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/dir.rbs +0 -33
  144. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/directory_iterator.rbs +0 -21
  145. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/file.rbs +0 -63
  146. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/file_stat.rbs +0 -55
  147. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem/zip_file_name_mapper.rbs +0 -35
  148. data/.gem_rbs_collection/rubyzip/3.2/zip/filesystem.rbs +0 -7
  149. data/.gem_rbs_collection/rubyzip/3.2/zip/inflater.rbs +0 -10
  150. data/.gem_rbs_collection/rubyzip/3.2/zip/input_stream.rbs +0 -22
  151. data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras/abstract_input_stream.rbs +0 -29
  152. data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras/abstract_output_stream.rbs +0 -17
  153. data/.gem_rbs_collection/rubyzip/3.2/zip/ioextras.rbs +0 -13
  154. data/.gem_rbs_collection/rubyzip/3.2/zip/null_compressor.rbs +0 -10
  155. data/.gem_rbs_collection/rubyzip/3.2/zip/null_decompressor.rbs +0 -8
  156. data/.gem_rbs_collection/rubyzip/3.2/zip/null_input_stream.rbs +0 -6
  157. data/.gem_rbs_collection/rubyzip/3.2/zip/output_stream.rbs +0 -30
  158. data/.gem_rbs_collection/rubyzip/3.2/zip/pass_thru_compressor.rbs +0 -10
  159. data/.gem_rbs_collection/rubyzip/3.2/zip/pass_thru_decompressor.rbs +0 -10
  160. data/.gem_rbs_collection/rubyzip/3.2/zip/streamable_directory.rbs +0 -5
  161. data/.gem_rbs_collection/rubyzip/3.2/zip/streamable_stream.rbs +0 -15
  162. data/.gem_rbs_collection/rubyzip/3.2/zip/version.rbs +0 -3
  163. data/.gem_rbs_collection/rubyzip/3.2/zip.rbs +0 -40
  164. data/Rakefile +0 -567
  165. data/Steepfile +0 -18
  166. data/benchmark.rb +0 -406
  167. data/docs/ARCHITECTURE.md +0 -514
  168. data/docs/DEVELOPMENT.md +0 -133
  169. data/docs/PEER_LIBRARIES.md +0 -121
  170. data/docs/QUALITY_ASSURANCE.md +0 -25
  171. data/docs/SPEC_SOURCES.md +0 -48
  172. data/docs/assets/benchmark_results.svg +0 -144
  173. data/docs/assets/lsp_autocompletion.png +0 -0
  174. data/docs/assets/playground_preview.png +0 -0
  175. data/docs/coi-serviceworker.js +0 -82
  176. data/docs/office_thread.js +0 -77
  177. data/docs/preview.html +0 -719
  178. data/docs/visual/VisualGallery.md +0 -4672
  179. data/docs/wasm/ruby.wasm +0 -0
  180. data/docs/wasm/wasm_doc_helper.css +0 -351
  181. data/docs/wasm/wasm_doc_helper.js +0 -439
  182. data/docs/zeta.js +0 -1107
  183. data/rbs_collection.lock.yaml +0 -252
  184. data/rbs_collection.yaml +0 -19
  185. data/vendor/sdk_runner/Program.cs +0 -93
  186. data/vendor/sdk_runner/sdk_runner.csproj +0 -13
@@ -62,8 +62,8 @@ module Xlsxrb
62
62
  # @param kwargs [Hash] Keyword arguments for legend styling/layout.
63
63
  # @return [Object] The configured legend property.
64
64
  # @api public
65
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
66
- def legend: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
65
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
66
+ def legend: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
67
67
 
68
68
  # Configures the plot_area property for this chart.
69
69
  #
@@ -71,8 +71,8 @@ module Xlsxrb
71
71
  # @param kwargs [Hash] Keyword arguments for plot area configuration.
72
72
  # @return [Object] The configured plot_area property.
73
73
  # @api public
74
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
75
- def plot_area: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
74
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
75
+ def plot_area: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
76
76
 
77
77
  # Configures the chart_space property for this chart.
78
78
  #
@@ -80,8 +80,8 @@ module Xlsxrb
80
80
  # @param kwargs [Hash] Keyword arguments.
81
81
  # @return [Object] The configured chart_space property.
82
82
  # @api public
83
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
84
- def chart_space: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
83
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
84
+ def chart_space: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
85
85
 
86
86
  # Configures the style index/id for this chart.
87
87
  #
@@ -89,8 +89,8 @@ module Xlsxrb
89
89
  # @param kwargs [Hash] Keyword arguments.
90
90
  # @return [Object] The configured style property.
91
91
  # @api public
92
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String | Integer) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String | Integer)
93
- def style: (*Hash[Symbol, String | Integer | bool | nil] | String | Integer args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String | Integer)
92
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String | Integer) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String | Integer)
93
+ def style: (*Hash[Symbol, String | Numeric | bool | nil] | String | Integer args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String | Integer)
94
94
 
95
95
  # Configures data labels for this chart.
96
96
  #
@@ -98,8 +98,8 @@ module Xlsxrb
98
98
  # @param kwargs [Hash] Keyword arguments.
99
99
  # @return [Object] The configured data_labels property.
100
100
  # @api public
101
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
102
- def data_labels: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
101
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
102
+ def data_labels: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
103
103
 
104
104
  # Configures whether to plot visible cells only.
105
105
  #
@@ -107,8 +107,8 @@ module Xlsxrb
107
107
  # @param kwargs [Hash] Keyword arguments.
108
108
  # @return [Boolean, String]
109
109
  # @api public
110
- # : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
111
- def plot_visible_only: (*bool | String args, **String | Integer | bool | nil kwargs) -> (bool | String)
110
+ # : (*(bool | String) args, **String | Numeric | bool | nil kwargs) -> (bool | String)
111
+ def plot_visible_only: (*bool | String args, **String | Numeric | bool | nil kwargs) -> (bool | String)
112
112
 
113
113
  # Configures how blank cells are displayed in the chart.
114
114
  #
@@ -116,8 +116,8 @@ module Xlsxrb
116
116
  # @param kwargs [Hash] Keyword arguments.
117
117
  # @return [String]
118
118
  # @api public
119
- # : (*(String) args, **String | Integer | bool | nil kwargs) -> String
120
- def display_blanks_as: (*String args, **String | Integer | bool | nil kwargs) -> String
119
+ # : (*(String) args, **String | Numeric | bool | nil kwargs) -> String
120
+ def display_blanks_as: (*String args, **String | Numeric | bool | nil kwargs) -> String
121
121
 
122
122
  # Configures 3D view properties for 3D charts.
123
123
  #
@@ -125,8 +125,8 @@ module Xlsxrb
125
125
  # @param kwargs [Hash] Keyword arguments.
126
126
  # @return [Object]
127
127
  # @api public
128
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
129
- def view3d: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
128
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
129
+ def view3d: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
130
130
 
131
131
  # Configures the category axis properties for this chart.
132
132
  #
@@ -134,8 +134,8 @@ module Xlsxrb
134
134
  # @param kwargs [Hash] Keyword arguments.
135
135
  # @return [Object]
136
136
  # @api public
137
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
138
- def category_axis: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
137
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
138
+ def category_axis: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
139
139
 
140
140
  # Configures the value axis properties for this chart.
141
141
  #
@@ -143,8 +143,8 @@ module Xlsxrb
143
143
  # @param kwargs [Hash] Keyword arguments.
144
144
  # @return [Object]
145
145
  # @api public
146
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
147
- def value_axis: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
146
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
147
+ def value_axis: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
148
148
 
149
149
  # Configures whether to show the legend key in data labels.
150
150
  #
@@ -152,8 +152,8 @@ module Xlsxrb
152
152
  # @param kwargs [Hash] Keyword arguments.
153
153
  # @return [Boolean, String]
154
154
  # @api public
155
- # : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
156
- def show_legend_key: (*bool | String args, **String | Integer | bool | nil kwargs) -> (bool | String)
155
+ # : (*(bool | String) args, **String | Numeric | bool | nil kwargs) -> (bool | String)
156
+ def show_legend_key: (*bool | String args, **String | Numeric | bool | nil kwargs) -> (bool | String)
157
157
 
158
158
  # Builder for a single series entry in block-style chart definitions.
159
159
  #
@@ -208,8 +208,8 @@ module Xlsxrb
208
208
  # @param kwargs [Hash] Keyword arguments.
209
209
  # @return [Object]
210
210
  # @api public
211
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
212
- def fill: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
211
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
212
+ def fill: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
213
213
 
214
214
  # Configures line color/thickness for this series.
215
215
  #
@@ -217,8 +217,8 @@ module Xlsxrb
217
217
  # @param kwargs [Hash] Keyword arguments.
218
218
  # @return [Object]
219
219
  # @api public
220
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
221
- def line: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
220
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
221
+ def line: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
222
222
 
223
223
  # Configures trendline for this series.
224
224
  #
@@ -226,8 +226,8 @@ module Xlsxrb
226
226
  # @param kwargs [Hash] Keyword arguments.
227
227
  # @return [Object]
228
228
  # @api public
229
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
230
- def trendline: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
229
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
230
+ def trendline: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
231
231
 
232
232
  # Configures data labels for this series.
233
233
  #
@@ -235,8 +235,8 @@ module Xlsxrb
235
235
  # @param kwargs [Hash] Keyword arguments.
236
236
  # @return [Object]
237
237
  # @api public
238
- # : (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
239
- def data_labels: (*Hash[Symbol, String | Integer | bool | nil] | String args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
238
+ # : (*(Hash[Symbol, String | Numeric | bool | nil] | String) args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
239
+ def data_labels: (*Hash[Symbol, String | Numeric | bool | nil] | String args, **String | Numeric | bool | nil kwargs) -> (Hash[Symbol, String | Numeric | bool | nil] | String)
240
240
 
241
241
  # Configures line smoothing for this series.
242
242
  #
@@ -244,8 +244,8 @@ module Xlsxrb
244
244
  # @param kwargs [Hash] Keyword arguments.
245
245
  # @return [Boolean, String]
246
246
  # @api public
247
- # : (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
248
- def smooth: (*bool | String args, **String | Integer | bool | nil kwargs) -> (bool | String)
247
+ # : (*(bool | String) args, **String | Numeric | bool | nil kwargs) -> (bool | String)
248
+ def smooth: (*bool | String args, **String | Numeric | bool | nil kwargs) -> (bool | String)
249
249
 
250
250
  # Configures 3D bar/column shape (e.g. "cylinder", "cone", "pyramid").
251
251
  #
@@ -253,8 +253,8 @@ module Xlsxrb
253
253
  # @param kwargs [Hash] Keyword arguments.
254
254
  # @return [String]
255
255
  # @api public
256
- # : (*(String) args, **String | Integer | bool | nil kwargs) -> String
257
- def shape: (*String args, **String | Integer | bool | nil kwargs) -> String
256
+ # : (*(String) args, **String | Numeric | bool | nil kwargs) -> String
257
+ def shape: (*String args, **String | Numeric | bool | nil kwargs) -> String
258
258
 
259
259
  # Configures individual series chart type override in combo charts.
260
260
  #
@@ -262,8 +262,8 @@ module Xlsxrb
262
262
  # @param kwargs [Hash] Keyword arguments.
263
263
  # @return [String]
264
264
  # @api public
265
- # : (*(String) args, **String | Integer | bool | nil kwargs) -> String
266
- def type: (*String args, **String | Integer | bool | nil kwargs) -> String
265
+ # : (*(String) args, **String | Numeric | bool | nil kwargs) -> String
266
+ def type: (*String args, **String | Numeric | bool | nil kwargs) -> String
267
267
  end
268
268
  end
269
269
  end
@@ -0,0 +1,92 @@
1
+ # Generated from lib/xlsxrb/dsl_helpers.rb with RBS::Inline
2
+
3
+ module Xlsxrb
4
+ # Internal helper module for normalizing and validating DSL arguments
5
+ # shared between {WorksheetBuilder} (in-memory) and {StreamWriter} (streaming).
6
+ #
7
+ # @api private
8
+ module DslHelpers
9
+ # Normalizes merge cell range string or coordinate components into a canonical range reference (e.g. "A1:C3").
10
+ #
11
+ # @param range [String, Hash, nil]
12
+ # @param row [Integer, nil]
13
+ # @param col_start [Integer, String, nil]
14
+ # @param col_end [Integer, String, nil]
15
+ # @param row_start [Integer, nil]
16
+ # @param row_end [Integer, nil]
17
+ # @param strict_excel_mode [Boolean]
18
+ # @return [String]
19
+ # : (untyped range, ?row: Integer?, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer?, ?row_end: Integer?, ?strict_excel_mode: bool) -> String
20
+ def self.normalize_merge_range: (untyped range, ?row: Integer?, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer?, ?row_end: Integer?, ?strict_excel_mode: bool) -> String
21
+
22
+ # Normalizes sheet protection options and hashes plain-text password if supplied.
23
+ #
24
+ # @param opts [Hash]
25
+ # @return [Hash]
26
+ # : (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
27
+ def self.normalize_protection_options: (Hash[Symbol, untyped] opts) -> Hash[Symbol, untyped]
28
+
29
+ # Normalizes column index or letter or Range to an array of 0-based column integers.
30
+ #
31
+ # @param index [Integer, String, Symbol, Range, Array]
32
+ # @return [Array<Integer>]
33
+ # : (untyped index) -> Array[Integer]
34
+ def self.normalize_column_indices: (untyped index) -> Array[Integer]
35
+
36
+ # Normalizes page margins into a compact hash.
37
+ #
38
+ # @param left [Float, nil]
39
+ # @param right [Float, nil]
40
+ # @param top [Float, nil]
41
+ # @param bottom [Float, nil]
42
+ # @param header [Float, nil]
43
+ # @param footer [Float, nil]
44
+ # @return [Hash{Symbol => Float}]
45
+ # : (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> Hash[Symbol, Float]
46
+ def self.normalize_page_margins: (?left: Float?, ?right: Float?, ?top: Float?, ?bottom: Float?, ?header: Float?, ?footer: Float?) -> Hash[Symbol, Float]
47
+
48
+ # Normalizes table options hash.
49
+ #
50
+ # @param ref [String]
51
+ # @param columns [Array<String>, Array<Hash>]
52
+ # @param name [String, nil]
53
+ # @param display_name [String, nil]
54
+ # @param style [String, nil]
55
+ # @param opts [Hash]
56
+ # @return [Hash]
57
+ # : (String ref, columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> Hash[Symbol, untyped]
58
+ def self.normalize_table_options: (String ref, columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> Hash[Symbol, untyped]
59
+
60
+ # Converts a cell range (e.g. "A1:B2" or "A1") to an absolute reference format (e.g. "$A$1:$B$2" or "$A$1").
61
+ #
62
+ # @param range [String]
63
+ # @return [String]
64
+ # : (String range) -> String
65
+ def self.absolute_range: (String range) -> String
66
+
67
+ # Normalizes row values: if given a column-keyed Hash, converts to a sparse Array.
68
+ # If already an Array or other non-Hash enumerable, returns as-is without allocations.
69
+ #
70
+ # @param values [Array<Object>, Hash{String, Integer, Symbol => Object}, nil]
71
+ # @return [Array<Object>, nil]
72
+ # : (untyped values) -> untyped
73
+ def self.normalize_row_values: (untyped values) -> untyped
74
+
75
+ # Normalizes row styles: if given a Hash of column-keyed styles (including Ranges/Arrays),
76
+ # expands to a sparse Array of styles. If already an Array or nil, returns as-is without allocations.
77
+ #
78
+ # @param styles [untyped]
79
+ # @return [untyped]
80
+ # : (untyped styles) -> untyped
81
+ def self.normalize_row_styles: (untyped styles) -> untyped
82
+
83
+ # Validates row index and height against Excel limits in strict mode.
84
+ #
85
+ # @param row_index [Integer]
86
+ # @param height [Float, Integer, nil]
87
+ # @param strict_excel_mode [Boolean]
88
+ # @return [void]
89
+ # : (Integer row_index, Float | Integer | nil height, ?strict_excel_mode: bool) -> void
90
+ def self.validate_row_bounds!: (Integer row_index, Float | Integer | nil height, ?strict_excel_mode: bool) -> void
91
+ end
92
+ end
@@ -115,6 +115,13 @@ module Xlsxrb
115
115
  # : () -> Time?
116
116
  def to_time: () -> Time?
117
117
 
118
+ # Pure calculation: converts a 0-based column index to an Excel letter.
119
+ #
120
+ # @param index [Integer] 0-based column index.
121
+ # @return [String] Excel column letter.
122
+ # : (Integer index) -> String
123
+ def self.calculate_column_letter: (Integer index) -> String
124
+
118
125
  # Converts a 0-based column index to an Excel letter (0 -> "A", 25 -> "Z", 26 -> "AA").
119
126
  #
120
127
  # @example
@@ -127,6 +134,13 @@ module Xlsxrb
127
134
  # : (untyped index) -> String
128
135
  def self.column_letter: (untyped index) -> String
129
136
 
137
+ # Pure calculation: converts an uppercase column letter string to a 0-based index.
138
+ #
139
+ # @param letter [String] Uppercase column letter string (e.g. "A", "AA").
140
+ # @return [Integer] 0-based column index.
141
+ # : (String letter) -> Integer
142
+ def self.calculate_column_index: (String letter) -> Integer
143
+
130
144
  # Converts a column letter (e.g. "A", :AA) to a 0-based column index.
131
145
  #
132
146
  # @example
@@ -151,6 +165,21 @@ module Xlsxrb
151
165
  # : (String? ref) -> [Integer, Integer]?
152
166
  def self.parse_ref: (String? ref) -> [ Integer, Integer ]?
153
167
 
168
+ # Returns whether the coordinates are within OOXML limits (row: 0..1,048,575, col: 0..16,383).
169
+ #
170
+ # @param row_index [Integer] 0-based row index.
171
+ # @param column_index [Integer] 0-based column index.
172
+ # @return [Boolean]
173
+ # : (untyped row_index, untyped column_index) -> bool
174
+ def self.valid_coordinates?: (untyped row_index, untyped column_index) -> bool
175
+
176
+ # Returns whether the value type is supported by OOXML specifications.
177
+ #
178
+ # @param value [Object]
179
+ # @return [Boolean]
180
+ # : (untyped value) -> bool
181
+ def self.valid_value?: (untyped value) -> bool
182
+
154
183
  # Validates cell coordinates and value type against OOXML specifications.
155
184
  #
156
185
  # @param row_index [Integer]
@@ -9,27 +9,38 @@ module Xlsxrb
9
9
  # col = Elements::Column.new(index: 0, width: 25.0)
10
10
  #
11
11
  # @api public
12
- class Column < Data
13
- attr_reader index(): untyped
14
-
15
- attr_reader width(): untyped
16
-
17
- attr_reader hidden(): untyped
18
-
19
- attr_reader custom_width(): untyped
20
-
21
- attr_reader outline_level(): untyped
22
-
23
- attr_reader unmapped_data(): untyped
24
-
25
- attr_reader errors(): untyped
26
-
27
- def self.new: (untyped index, untyped width, untyped hidden, untyped custom_width, untyped outline_level, untyped unmapped_data, untyped errors) -> instance
28
- | (index: untyped, width: untyped, hidden: untyped, custom_width: untyped, outline_level: untyped, unmapped_data: untyped, errors: untyped) -> instance
29
-
30
- def self.members: () -> [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
31
-
32
- def members: () -> [ :index, :width, :hidden, :custom_width, :outline_level, :unmapped_data, :errors ]
12
+ # rubocop:disable Style/DataInheritance -- Required as class syntax for mutant subject matcher
13
+ class Column
14
+ # rubocop:enable Style/DataInheritance
15
+ # @param index [Integer] 0-based column index.
16
+ # @param width [Float, Integer, nil] Column width in characters.
17
+ # @param hidden [Boolean] Whether the column is hidden.
18
+ # @param custom_width [Boolean] Whether custom width flag is set.
19
+ # @param outline_level [Integer, nil] Grouping/outline level.
20
+ # @param unmapped_data [Hash] Additional metadata.
21
+ # @param errors [Array<String>, nil] Validation errors.
22
+ # : (index: Integer, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
23
+ def initialize: (index: Integer, ?width: Float | Integer | nil, ?hidden: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
24
+
25
+ # Returns whether the column definition is valid according to OOXML specifications.
26
+ #
27
+ # @return [Boolean]
28
+ # : () -> bool
29
+ def valid?: () -> bool
30
+
31
+ # Returns whether the column index is within valid OOXML range (0..16383).
32
+ #
33
+ # @param index [Object]
34
+ # @return [Boolean]
35
+ # : (untyped index) -> bool
36
+ def self.valid_index?: (untyped index) -> bool
37
+
38
+ # Validates column index against OOXML limits.
39
+ #
40
+ # @param index [Integer]
41
+ # @return [Array<String>] List of errors.
42
+ # : (untyped index) -> Array[String]
43
+ def self.validate: (untyped index) -> Array[String]
33
44
  end
34
45
  end
35
46
  end
@@ -11,29 +11,109 @@ module Xlsxrb
11
11
  # row.to_a # array of cell values
12
12
  #
13
13
  # @api public
14
- class Row < Data
15
- attr_reader index(): untyped
14
+ # rubocop:disable Style/DataInheritance -- Required as class syntax for mutant subject matcher
15
+ class Row
16
+ # @param index [Integer] 0-based row index.
17
+ # @param cells [Array<Elements::Cell>] Cells in this row.
18
+ # @param height [Float, Integer, nil] Row height in points.
19
+ # @param hidden [Boolean] Whether the row is hidden.
20
+ # @param custom_height [Boolean] Whether custom height is set.
21
+ # @param outline_level [Integer, nil] Grouping/outline level.
22
+ # @param unmapped_data [Hash] Additional metadata.
23
+ # @param errors [Array<String>, nil] Validation errors.
24
+ # : (index: Integer, ?cells: Array[Elements::Cell], ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil, ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
25
+ def initialize: (index: Integer, ?cells: Array[Elements::Cell], ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil, ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
16
26
 
17
- attr_reader cells(): untyped
27
+ # Access a cell by 0-based column index, or access row attributes via Symbol.
28
+ #
29
+ # @example
30
+ # row[0] #=> Cell at column 0
31
+ # row[:height] #=> 25.0
32
+ # row[:cells] #=> [Cell, Cell, ...]
33
+ #
34
+ # @param col_index [Integer, Symbol] Column index or attribute symbol.
35
+ # @return [Elements::Cell, Object, nil]
36
+ # @api public
37
+ # : (Integer | Symbol col_index) -> untyped
38
+ def []: (Integer | Symbol col_index) -> untyped
18
39
 
19
- attr_reader height(): untyped
40
+ # Iterate over cells in this row.
41
+ #
42
+ # @example
43
+ # row.each do |cell|
44
+ # puts cell.value
45
+ # end
46
+ #
47
+ # @yield [cell]
48
+ # @yieldparam cell [Elements::Cell]
49
+ # @return [Enumerator, void]
50
+ # @api public
51
+ # : () { (Elements::Cell) -> void } -> void
52
+ # : () -> Enumerator[Elements::Cell, void]
53
+ def each: () { (Elements::Cell) -> void } -> void
54
+ | () -> Enumerator[Elements::Cell, void]
20
55
 
21
- attr_reader hidden(): untyped
56
+ # Iterate over cells in this row.
57
+ #
58
+ # @example
59
+ # row.each_cell do |cell|
60
+ # puts "#{cell.ref}: #{cell.value}"
61
+ # end
62
+ #
63
+ # @yield [cell]
64
+ # @yieldparam cell [Elements::Cell]
65
+ # @return [Enumerator, void]
66
+ # @api public
67
+ # : () { (Elements::Cell) -> void } -> void
68
+ # : () -> Enumerator[Elements::Cell, void]
69
+ def each_cell: () { (Elements::Cell) -> void } -> void
70
+ | () -> Enumerator[Elements::Cell, void]
22
71
 
23
- attr_reader custom_height(): untyped
72
+ # Convert row cells to an Array of raw values.
73
+ #
74
+ # @example
75
+ # row.to_a #=> ["ID", "Name", "Total"]
76
+ #
77
+ # @return [Array<Object>]
78
+ # @api public
79
+ # : () -> Array[untyped]
80
+ def to_a: () -> Array[untyped]
24
81
 
25
- attr_reader outline_level(): untyped
82
+ # Returns whether the row is valid according to OOXML specifications.
83
+ #
84
+ # @return [Boolean]
85
+ # : () -> bool
86
+ def valid?: () -> bool
26
87
 
27
- attr_reader unmapped_data(): untyped
88
+ # Returns the cell at the given 0-based column index, or nil.
89
+ #
90
+ # @param column_index [Integer] 0-based column index.
91
+ # @return [Elements::Cell, nil]
92
+ # @api public
93
+ # : (Integer column_index) -> Elements::Cell?
94
+ def cell_at: (Integer column_index) -> Elements::Cell?
28
95
 
29
- attr_reader errors(): untyped
96
+ # Returns cell values as an Array (sparse columns get nil).
97
+ #
98
+ # @return [Array<Object>]
99
+ # @api public
100
+ # : () -> Array[untyped]
101
+ def values: () -> Array[untyped]
30
102
 
31
- def self.new: (untyped index, untyped cells, untyped height, untyped hidden, untyped custom_height, untyped outline_level, untyped unmapped_data, untyped errors) -> instance
32
- | (index: untyped, cells: untyped, height: untyped, hidden: untyped, custom_height: untyped, outline_level: untyped, unmapped_data: untyped, errors: untyped) -> instance
103
+ # Returns whether the row index is within valid OOXML range (0..1048575).
104
+ #
105
+ # @param index [Object]
106
+ # @return [Boolean]
107
+ # : (untyped index) -> bool
108
+ def self.valid_index?: (untyped index) -> bool
33
109
 
34
- def self.members: () -> [ :index, :cells, :height, :hidden, :custom_height, :outline_level, :unmapped_data, :errors ]
35
-
36
- def members: () -> [ :index, :cells, :height, :hidden, :custom_height, :outline_level, :unmapped_data, :errors ]
110
+ # Validates row index and cells against OOXML limits.
111
+ #
112
+ # @param index [Integer]
113
+ # @param cells [Array<Elements::Cell>]
114
+ # @return [Array<String>] List of errors.
115
+ # : (untyped index, untyped cells) -> Array[String]
116
+ def self.validate: (untyped index, untyped cells) -> Array[String]
37
117
  end
38
118
  end
39
119
  end
@@ -10,23 +10,115 @@ module Xlsxrb
10
10
  # workbook.each { |s| puts s.name }
11
11
  #
12
12
  # @api public
13
- class Workbook < Data
14
- attr_reader sheets(): untyped
13
+ # rubocop:disable Style/DataInheritance -- Required as class syntax for mutant subject matcher
14
+ class Workbook
15
+ # @param sheets [Array<Elements::Worksheet, StreamSheet>] Worksheets in the workbook.
16
+ # @param shared_strings [Array<String>] Shared strings table.
17
+ # @param styles [Hash] Styles definition.
18
+ # @param unmapped_data [Hash] Additional metadata for round-tripping.
19
+ # @param errors [Array<String>, nil] Validation errors.
20
+ # : (?sheets: Array[Elements::Worksheet | StreamSheet], ?shared_strings: Array[String], ?styles: Hash[untyped, untyped], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
21
+ def initialize: (?sheets: Array[Elements::Worksheet | StreamSheet], ?shared_strings: Array[String], ?styles: Hash[untyped, untyped], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
15
22
 
16
- attr_reader shared_strings(): untyped
23
+ # Iterate over worksheets.
24
+ #
25
+ # @example
26
+ # workbook.each do |sheet|
27
+ # puts sheet.name
28
+ # end
29
+ #
30
+ # @yield [sheet]
31
+ # @yieldparam sheet [Elements::Worksheet, StreamSheet]
32
+ # @return [Enumerator, void]
33
+ # : () { (Elements::Worksheet | StreamSheet) -> void } -> void
34
+ # : () -> Enumerator[Elements::Worksheet | StreamSheet, void]
35
+ def each: () { (Elements::Worksheet | StreamSheet) -> void } -> void
36
+ | () -> Enumerator[Elements::Worksheet | StreamSheet, void]
17
37
 
18
- attr_reader styles(): untyped
38
+ alias each_sheet each
19
39
 
20
- attr_reader unmapped_data(): untyped
40
+ # Returns whether the workbook is valid according to ECMA-376 rules.
41
+ #
42
+ # @return [Boolean]
43
+ # : () -> bool
44
+ def valid?: () -> bool
21
45
 
22
- attr_reader errors(): untyped
46
+ # Returns the worksheet at the given 0-based index or by name.
47
+ #
48
+ # @example
49
+ # wb.sheet(0)
50
+ # wb.sheet("Sales")
51
+ #
52
+ # @param identifier [Integer, String, untyped] 0-based index or sheet name.
53
+ # @return [Elements::Worksheet, StreamSheet, nil]
54
+ # @api public
55
+ # : (?Integer | String | untyped identifier) -> (Elements::Worksheet | StreamSheet)?
56
+ def sheet: (?Integer | String | untyped identifier) -> (Elements::Worksheet | StreamSheet)?
23
57
 
24
- def self.new: (untyped sheets, untyped shared_strings, untyped styles, untyped unmapped_data, untyped errors) -> instance
25
- | (sheets: untyped, shared_strings: untyped, styles: untyped, unmapped_data: untyped, errors: untyped) -> instance
58
+ alias [] sheet
26
59
 
27
- def self.members: () -> [ :sheets, :shared_strings, :styles, :unmapped_data, :errors ]
60
+ # Loads all sheets into memory, returning an Elements::Workbook where every
61
+ # worksheet is a fully-parsed Elements::Worksheet supporting coordinate random access.
62
+ #
63
+ # @example
64
+ # wb = Xlsxrb.read("file.xlsx").load
65
+ # puts wb["Sheet1"]["A1"].value
66
+ #
67
+ # @return [Elements::Workbook]
68
+ # @api public
69
+ # : () -> Elements::Workbook
70
+ def load: () -> Elements::Workbook
28
71
 
29
- def members: () -> [ :sheets, :shared_strings, :styles, :unmapped_data, :errors ]
72
+ alias to_workbook load
73
+
74
+ # Closes any streaming resources associated with worksheets.
75
+ #
76
+ # @return [void]
77
+ # @api public
78
+ # : () -> void
79
+ def close: () -> void
80
+
81
+ # Returns a new Workbook with the specified sheet updated.
82
+ # Yields the matched worksheet to the block, which must return a new Worksheet.
83
+ #
84
+ # @example
85
+ # new_wb = wb.update_sheet("Sheet1") do |sheet|
86
+ # sheet.update_cell("A1", value: "New Title")
87
+ # end
88
+ #
89
+ # @param identifier [Integer, String] 0-based index or sheet name.
90
+ # @yield [sheet]
91
+ # @yieldparam sheet [Elements::Worksheet] The worksheet to update.
92
+ # @yieldreturn [Elements::Worksheet] The modified worksheet.
93
+ # @return [Elements::Workbook] A new Workbook instance.
94
+ # @api public
95
+ # : (Integer | String identifier) ?{ (Elements::Worksheet) -> Elements::Worksheet } -> Elements::Workbook
96
+ def update_sheet: (Integer | String identifier) ?{ (Elements::Worksheet) -> Elements::Worksheet } -> Elements::Workbook
97
+
98
+ # Returns an Array of all worksheet names.
99
+ #
100
+ # @return [Array<String>]
101
+ # @api public
102
+ # : () -> Array[String]
103
+ def sheet_names: () -> Array[String]
104
+
105
+ # Save the workbook to an XLSX file.
106
+ #
107
+ # @example
108
+ # wb.save("output.xlsx")
109
+ #
110
+ # @param filepath [String, IO, StringIO] Destination file path or IO stream.
111
+ # @return [void]
112
+ # @api public
113
+ # : (String | IO | StringIO filepath) -> void
114
+ def save: (String | IO | StringIO filepath) -> void
115
+
116
+ # Validates workbook structure according to OOXML specifications.
117
+ #
118
+ # @param sheets [Array<Elements::Worksheet>]
119
+ # @return [Array<String>] List of error messages.
120
+ # : (untyped sheets) -> Array[String]
121
+ def self.validate: (untyped sheets) -> Array[String]
30
122
  end
31
123
  end
32
124
  end