xlsxrb 0.1.8 → 0.1.10
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -2
- data/README.md +77 -222
- data/Rakefile +22 -3
- data/docs/DEVELOPMENT.md +11 -3
- data/docs/PEER_LIBRARIES.md +121 -0
- data/docs/QUALITY_ASSURANCE.md +3 -4
- data/docs/SPEC_SOURCES.md +7 -1
- data/docs/assets/benchmark_results.svg +144 -0
- data/docs/assets/lsp_autocompletion.png +0 -0
- data/docs/assets/playground_preview.png +0 -0
- data/docs/visual/VisualGallery.md +183 -0
- data/docs/wasm/ruby.wasm +0 -0
- data/lib/xlsxrb/chart_builder.rb +333 -0
- data/lib/xlsxrb/elements/row.rb +2 -2
- data/lib/xlsxrb/elements/workbook.rb +3 -3
- data/lib/xlsxrb/elements/worksheet.rb +4 -4
- data/lib/xlsxrb/ooxml/cfb.rb +490 -0
- data/lib/xlsxrb/ooxml/crypto/agile.rb +285 -0
- data/lib/xlsxrb/ooxml/crypto/standard.rb +152 -0
- data/lib/xlsxrb/ooxml/crypto.rb +60 -0
- data/lib/xlsxrb/ooxml/reader/listeners.rb +6450 -0
- data/lib/xlsxrb/ooxml/reader.rb +2 -6438
- data/lib/xlsxrb/ooxml/workbook_writer.rb +10 -10
- data/lib/xlsxrb/ooxml/worksheet_parser.rb +161 -116
- data/lib/xlsxrb/ooxml/worksheet_writer.rb +5 -1
- data/lib/xlsxrb/stream_row.rb +7 -5
- data/lib/xlsxrb/stream_sheet.rb +125 -0
- data/lib/xlsxrb/stream_writer.rb +1646 -0
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb/workbook_builder.rb +309 -0
- data/lib/xlsxrb/worksheet_builder.rb +691 -0
- data/lib/xlsxrb.rb +350 -2989
- data/sig/generated/xlsxrb/chart_builder.rbs +269 -0
- data/sig/generated/xlsxrb/elements/worksheet.rbs +8 -5
- data/sig/generated/xlsxrb/ooxml/cfb.rbs +121 -0
- data/sig/generated/xlsxrb/ooxml/crypto/agile.rbs +46 -0
- data/sig/generated/xlsxrb/ooxml/crypto/standard.rbs +28 -0
- data/sig/generated/xlsxrb/ooxml/crypto.rbs +17 -0
- data/sig/generated/xlsxrb/ooxml/reader/listeners.rbs +1074 -0
- data/sig/generated/xlsxrb/ooxml/reader.rbs +0 -1067
- data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +3 -3
- data/sig/generated/xlsxrb/stream_row.rbs +7 -4
- data/sig/generated/xlsxrb/stream_sheet.rbs +100 -0
- data/sig/generated/xlsxrb/stream_writer.rbs +954 -0
- data/sig/generated/xlsxrb/workbook_builder.rbs +146 -0
- data/sig/generated/xlsxrb/worksheet_builder.rbs +349 -0
- data/sig/generated/xlsxrb.rbs +131 -1569
- data/vendor/sdk_runner/Program.cs +3 -1
- metadata +25 -1
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# rbs_inline: enabled
|
|
4
|
+
|
|
5
|
+
module Xlsxrb
|
|
6
|
+
# Builder for block-style chart definitions.
|
|
7
|
+
#
|
|
8
|
+
# @example Create a chart definition
|
|
9
|
+
# builder = ChartBuilder.new
|
|
10
|
+
# builder.type(:bar)
|
|
11
|
+
# builder.title("Quarterly Sales")
|
|
12
|
+
# builder.series do |s|
|
|
13
|
+
# s.name("2026")
|
|
14
|
+
# s.categories("Sheet1!$A$2:$A$5")
|
|
15
|
+
# s.values("Sheet1!$B$2:$B$5")
|
|
16
|
+
# end
|
|
17
|
+
#
|
|
18
|
+
# @api public
|
|
19
|
+
class ChartBuilder
|
|
20
|
+
# @return [Hash{Symbol => Object}] The configured chart options.
|
|
21
|
+
#: () -> void
|
|
22
|
+
def initialize
|
|
23
|
+
@options = {}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @return [Hash{Symbol => Object}]
|
|
27
|
+
#: Hash[Symbol, untyped]
|
|
28
|
+
attr_reader :options
|
|
29
|
+
|
|
30
|
+
# Sets the chart type (e.g. :line, :bar, :pie, :area, :radar, :scatter).
|
|
31
|
+
#
|
|
32
|
+
# @param value [Symbol, String] Chart type.
|
|
33
|
+
# @return [Symbol, String]
|
|
34
|
+
# @api public
|
|
35
|
+
#: (Symbol | String value) -> (Symbol | String)
|
|
36
|
+
def type(value)
|
|
37
|
+
@options[:type] = value
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Sets the chart title.
|
|
41
|
+
#
|
|
42
|
+
# @param value [String, Hash, nil] Chart title text or options hash.
|
|
43
|
+
# @return [String, Hash, nil]
|
|
44
|
+
# @api public
|
|
45
|
+
#: (String | Hash[Symbol, untyped] | nil value) -> (String | Hash[Symbol, untyped] | nil)
|
|
46
|
+
def title(value)
|
|
47
|
+
@options[:title] = value
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Adds a data series to the chart.
|
|
51
|
+
#
|
|
52
|
+
# @overload series(value)
|
|
53
|
+
# Adds a pre-built series options hash.
|
|
54
|
+
# @param value [Hash{Symbol => Object}] Series options hash.
|
|
55
|
+
# @return [Array<Hash{Symbol => Object}>]
|
|
56
|
+
#
|
|
57
|
+
# @overload series(&block)
|
|
58
|
+
# Configures a series using a block.
|
|
59
|
+
# @yield [series_builder]
|
|
60
|
+
# @yieldparam series_builder [SeriesBuilder]
|
|
61
|
+
# @return [Array<Hash{Symbol => Object}>]
|
|
62
|
+
#
|
|
63
|
+
# @api public
|
|
64
|
+
#: (?Hash[Symbol, untyped]? value) ?{ (SeriesBuilder) -> void } -> Array[Hash[Symbol, untyped]]
|
|
65
|
+
def series(value = nil)
|
|
66
|
+
@options[:series] ||= []
|
|
67
|
+
if block_given?
|
|
68
|
+
sb = SeriesBuilder.new
|
|
69
|
+
yield sb
|
|
70
|
+
@options[:series] << sb.options
|
|
71
|
+
elsif value
|
|
72
|
+
@options[:series] << value
|
|
73
|
+
end
|
|
74
|
+
@options[:series]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Configures the legend property for this chart.
|
|
78
|
+
#
|
|
79
|
+
# @param args [Array] Positional arguments (e.g. position string).
|
|
80
|
+
# @param kwargs [Hash] Keyword arguments for legend styling/layout.
|
|
81
|
+
# @return [Object] The configured legend property.
|
|
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 legend(*args, **kwargs)
|
|
85
|
+
@options[:legend] = kwargs.empty? ? args.first : kwargs
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Configures the plot_area property for this chart.
|
|
89
|
+
#
|
|
90
|
+
# @param args [Array] Positional arguments.
|
|
91
|
+
# @param kwargs [Hash] Keyword arguments for plot area configuration.
|
|
92
|
+
# @return [Object] The configured plot_area property.
|
|
93
|
+
# @api public
|
|
94
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
95
|
+
def plot_area(*args, **kwargs)
|
|
96
|
+
@options[:plot_area] = kwargs.empty? ? args.first : kwargs
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Configures the chart_space property for this chart.
|
|
100
|
+
#
|
|
101
|
+
# @param args [Array] Positional arguments.
|
|
102
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
103
|
+
# @return [Object] The configured chart_space property.
|
|
104
|
+
# @api public
|
|
105
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
106
|
+
def chart_space(*args, **kwargs)
|
|
107
|
+
@options[:chart_space] = kwargs.empty? ? args.first : kwargs
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Configures the style index/id for this chart.
|
|
111
|
+
#
|
|
112
|
+
# @param args [Array] Positional arguments.
|
|
113
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
114
|
+
# @return [Object] The configured style property.
|
|
115
|
+
# @api public
|
|
116
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String | Integer) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String | Integer)
|
|
117
|
+
def style(*args, **kwargs)
|
|
118
|
+
@options[:style] = kwargs.empty? ? args.first : kwargs
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Configures data labels for this chart.
|
|
122
|
+
#
|
|
123
|
+
# @param args [Array] Positional arguments.
|
|
124
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
125
|
+
# @return [Object] The configured data_labels property.
|
|
126
|
+
# @api public
|
|
127
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
128
|
+
def data_labels(*args, **kwargs)
|
|
129
|
+
@options[:data_labels] = kwargs.empty? ? args.first : kwargs
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Configures whether to plot visible cells only.
|
|
133
|
+
#
|
|
134
|
+
# @param args [Array] Positional arguments.
|
|
135
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
136
|
+
# @return [Boolean, String]
|
|
137
|
+
# @api public
|
|
138
|
+
#: (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
|
|
139
|
+
def plot_visible_only(*args, **kwargs)
|
|
140
|
+
@options[:plot_visible_only] = kwargs.empty? ? args.first : kwargs
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Configures how blank cells are displayed in the chart.
|
|
144
|
+
#
|
|
145
|
+
# @param args [Array] Positional arguments.
|
|
146
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
147
|
+
# @return [String]
|
|
148
|
+
# @api public
|
|
149
|
+
#: (*(String) args, **String | Integer | bool | nil kwargs) -> String
|
|
150
|
+
def display_blanks_as(*args, **kwargs)
|
|
151
|
+
@options[:display_blanks_as] = kwargs.empty? ? args.first : kwargs
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Configures 3D view properties for 3D charts.
|
|
155
|
+
#
|
|
156
|
+
# @param args [Array] Positional arguments.
|
|
157
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
158
|
+
# @return [Object]
|
|
159
|
+
# @api public
|
|
160
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
161
|
+
def view3d(*args, **kwargs)
|
|
162
|
+
@options[:view3d] = kwargs.empty? ? args.first : kwargs
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Configures the category axis properties for this chart.
|
|
166
|
+
#
|
|
167
|
+
# @param args [Array] Positional arguments.
|
|
168
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
169
|
+
# @return [Object]
|
|
170
|
+
# @api public
|
|
171
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
172
|
+
def category_axis(*args, **kwargs)
|
|
173
|
+
@options[:category_axis] = kwargs.empty? ? args.first : kwargs
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Configures the value axis properties for this chart.
|
|
177
|
+
#
|
|
178
|
+
# @param args [Array] Positional arguments.
|
|
179
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
180
|
+
# @return [Object]
|
|
181
|
+
# @api public
|
|
182
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
183
|
+
def value_axis(*args, **kwargs)
|
|
184
|
+
@options[:value_axis] = kwargs.empty? ? args.first : kwargs
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Configures whether to show the legend key in data labels.
|
|
188
|
+
#
|
|
189
|
+
# @param args [Array] Positional arguments.
|
|
190
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
191
|
+
# @return [Boolean, String]
|
|
192
|
+
# @api public
|
|
193
|
+
#: (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
|
|
194
|
+
def show_legend_key(*args, **kwargs)
|
|
195
|
+
@options[:show_legend_key] = kwargs.empty? ? args.first : kwargs
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Builder for a single series entry in block-style chart definitions.
|
|
199
|
+
#
|
|
200
|
+
# @api public
|
|
201
|
+
class SeriesBuilder
|
|
202
|
+
#: () -> void
|
|
203
|
+
def initialize
|
|
204
|
+
@options = {}
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# @return [Hash{Symbol => Object}]
|
|
208
|
+
#: Hash[Symbol, untyped]
|
|
209
|
+
attr_reader :options
|
|
210
|
+
|
|
211
|
+
# Configures categories reference for this series (e.g. "Sheet1!$A$2:$A$10").
|
|
212
|
+
#
|
|
213
|
+
# @param args [Array] Positional arguments.
|
|
214
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
215
|
+
# @return [Object]
|
|
216
|
+
# @api public
|
|
217
|
+
#: (*untyped args, **untyped kwargs) -> untyped
|
|
218
|
+
def categories(*args, **kwargs)
|
|
219
|
+
@options[:categories] = kwargs.empty? ? args.first : kwargs
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Configures values reference for this series (e.g. "Sheet1!$B$2:$B$10").
|
|
223
|
+
#
|
|
224
|
+
# @param args [Array] Positional arguments.
|
|
225
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
226
|
+
# @return [Object]
|
|
227
|
+
# @api public
|
|
228
|
+
#: (*untyped args, **untyped kwargs) -> untyped
|
|
229
|
+
def values(*args, **kwargs)
|
|
230
|
+
@options[:values] = kwargs.empty? ? args.first : kwargs
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Configures the name for this series (e.g. "Total Sales" or cell reference "Sheet1!$B$1").
|
|
234
|
+
#
|
|
235
|
+
# @param args [Array] Positional arguments.
|
|
236
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
237
|
+
# @return [Object]
|
|
238
|
+
# @api public
|
|
239
|
+
#: (*untyped args, **untyped kwargs) -> untyped
|
|
240
|
+
def name(*args, **kwargs)
|
|
241
|
+
@options[:name] = kwargs.empty? ? args.first : kwargs
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Configures data markers for this series.
|
|
245
|
+
#
|
|
246
|
+
# @param args [Array] Positional arguments.
|
|
247
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
248
|
+
# @return [Object]
|
|
249
|
+
# @api public
|
|
250
|
+
#: (*untyped args, **untyped kwargs) -> untyped
|
|
251
|
+
def marker(*args, **kwargs)
|
|
252
|
+
@options[:marker] = kwargs.empty? ? args.first : kwargs
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Configures fill color/pattern for this series.
|
|
256
|
+
#
|
|
257
|
+
# @param args [Array] Positional arguments.
|
|
258
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
259
|
+
# @return [Object]
|
|
260
|
+
# @api public
|
|
261
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
262
|
+
def fill(*args, **kwargs)
|
|
263
|
+
@options[:fill] = kwargs.empty? ? args.first : kwargs
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Configures line color/thickness for this series.
|
|
267
|
+
#
|
|
268
|
+
# @param args [Array] Positional arguments.
|
|
269
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
270
|
+
# @return [Object]
|
|
271
|
+
# @api public
|
|
272
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
273
|
+
def line(*args, **kwargs)
|
|
274
|
+
@options[:line] = kwargs.empty? ? args.first : kwargs
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Configures trendline for this series.
|
|
278
|
+
#
|
|
279
|
+
# @param args [Array] Positional arguments.
|
|
280
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
281
|
+
# @return [Object]
|
|
282
|
+
# @api public
|
|
283
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
284
|
+
def trendline(*args, **kwargs)
|
|
285
|
+
@options[:trendline] = kwargs.empty? ? args.first : kwargs
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Configures data labels for this series.
|
|
289
|
+
#
|
|
290
|
+
# @param args [Array] Positional arguments.
|
|
291
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
292
|
+
# @return [Object]
|
|
293
|
+
# @api public
|
|
294
|
+
#: (*(Hash[Symbol, String | Integer | bool | nil] | String) args, **String | Integer | bool | nil kwargs) -> (Hash[Symbol, String | Integer | bool | nil] | String)
|
|
295
|
+
def data_labels(*args, **kwargs)
|
|
296
|
+
@options[:data_labels] = kwargs.empty? ? args.first : kwargs
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Configures line smoothing for this series.
|
|
300
|
+
#
|
|
301
|
+
# @param args [Array] Positional arguments.
|
|
302
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
303
|
+
# @return [Boolean, String]
|
|
304
|
+
# @api public
|
|
305
|
+
#: (*(bool | String) args, **String | Integer | bool | nil kwargs) -> (bool | String)
|
|
306
|
+
def smooth(*args, **kwargs)
|
|
307
|
+
@options[:smooth] = kwargs.empty? ? args.first : kwargs
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Configures 3D bar/column shape (e.g. "cylinder", "cone", "pyramid").
|
|
311
|
+
#
|
|
312
|
+
# @param args [Array] Positional arguments.
|
|
313
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
314
|
+
# @return [String]
|
|
315
|
+
# @api public
|
|
316
|
+
#: (*(String) args, **String | Integer | bool | nil kwargs) -> String
|
|
317
|
+
def shape(*args, **kwargs)
|
|
318
|
+
@options[:shape] = kwargs.empty? ? args.first : kwargs
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Configures individual series chart type override in combo charts.
|
|
322
|
+
#
|
|
323
|
+
# @param args [Array] Positional arguments.
|
|
324
|
+
# @param kwargs [Hash] Keyword arguments.
|
|
325
|
+
# @return [String]
|
|
326
|
+
# @api public
|
|
327
|
+
#: (*(String) args, **String | Integer | bool | nil kwargs) -> String
|
|
328
|
+
def type(*args, **kwargs)
|
|
329
|
+
@options[:type] = kwargs.empty? ? args.first : kwargs
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
end
|
data/lib/xlsxrb/elements/row.rb
CHANGED
|
@@ -75,7 +75,7 @@ module Xlsxrb
|
|
|
75
75
|
# @return [Enumerator, void]
|
|
76
76
|
# @api public
|
|
77
77
|
#: () { (Elements::Cell) -> void } -> void
|
|
78
|
-
#:
|
|
78
|
+
#: () -> Enumerator[Elements::Cell, void]
|
|
79
79
|
def each(&)
|
|
80
80
|
return to_enum(:each) unless block_given?
|
|
81
81
|
|
|
@@ -94,7 +94,7 @@ module Xlsxrb
|
|
|
94
94
|
# @return [Enumerator, void]
|
|
95
95
|
# @api public
|
|
96
96
|
#: () { (Elements::Cell) -> void } -> void
|
|
97
|
-
#:
|
|
97
|
+
#: () -> Enumerator[Elements::Cell, void]
|
|
98
98
|
def each_cell(&)
|
|
99
99
|
return to_enum(:each_cell) unless block_given?
|
|
100
100
|
|
|
@@ -38,7 +38,7 @@ module Xlsxrb
|
|
|
38
38
|
# @yieldparam sheet [Elements::Worksheet]
|
|
39
39
|
# @return [Enumerator, void]
|
|
40
40
|
#: () { (Elements::Worksheet) -> void } -> void
|
|
41
|
-
#:
|
|
41
|
+
#: () -> Enumerator[Elements::Worksheet, void]
|
|
42
42
|
def each(&)
|
|
43
43
|
sheets.each(&)
|
|
44
44
|
end
|
|
@@ -131,10 +131,10 @@ module Xlsxrb
|
|
|
131
131
|
# @example
|
|
132
132
|
# wb.save("output.xlsx")
|
|
133
133
|
#
|
|
134
|
-
# @param filepath [String, IO] Destination file path or IO stream.
|
|
134
|
+
# @param filepath [String, IO, StringIO] Destination file path or IO stream.
|
|
135
135
|
# @return [void]
|
|
136
136
|
# @api public
|
|
137
|
-
#: (
|
|
137
|
+
#: (String | IO | StringIO filepath) -> void
|
|
138
138
|
def save(filepath)
|
|
139
139
|
Xlsxrb.write(filepath, self)
|
|
140
140
|
end
|
|
@@ -25,7 +25,7 @@ module Xlsxrb
|
|
|
25
25
|
# @param charts [Array<Hash>] Charts in the sheet.
|
|
26
26
|
# @param unmapped_data [Hash] Additional metadata for round-tripping.
|
|
27
27
|
# @param errors [Array<String>, nil] Validation errors.
|
|
28
|
-
#: (name: String
|
|
28
|
+
#: (name: String?, ?rows: Array[Elements::Row], ?columns: Array[Elements::Column], ?charts: Array[Hash[Symbol, untyped]], ?unmapped_data: Hash[untyped, untyped], ?errors: Array[String]?) -> void
|
|
29
29
|
def initialize(name:, rows: [], columns: [], charts: [], unmapped_data: {}, errors: nil)
|
|
30
30
|
@name = name
|
|
31
31
|
@rows = (rows || []).freeze
|
|
@@ -48,7 +48,7 @@ module Xlsxrb
|
|
|
48
48
|
# @return [Enumerator, void]
|
|
49
49
|
# @api public
|
|
50
50
|
#: () { (Elements::Row) -> void } -> void
|
|
51
|
-
#:
|
|
51
|
+
#: () -> Enumerator[Elements::Row, void]
|
|
52
52
|
def each(&)
|
|
53
53
|
return to_enum(:each) unless block_given?
|
|
54
54
|
|
|
@@ -67,7 +67,7 @@ module Xlsxrb
|
|
|
67
67
|
# @return [Enumerator, void]
|
|
68
68
|
# @api public
|
|
69
69
|
#: () { (Elements::Row) -> void } -> void
|
|
70
|
-
#:
|
|
70
|
+
#: () -> Enumerator[Elements::Row, void]
|
|
71
71
|
def each_row(&)
|
|
72
72
|
return to_enum(:each_row) unless block_given?
|
|
73
73
|
|
|
@@ -81,7 +81,7 @@ module Xlsxrb
|
|
|
81
81
|
# @return [Enumerator, void]
|
|
82
82
|
# @api public
|
|
83
83
|
#: () { (Elements::Cell) -> void } -> void
|
|
84
|
-
#:
|
|
84
|
+
#: () -> Enumerator[Elements::Cell, void]
|
|
85
85
|
def each_cell(&)
|
|
86
86
|
return to_enum(:each_cell) unless block_given?
|
|
87
87
|
|