ironcalc 0.7.1.3-aarch64-linux

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8f20716c235736d94029ec463377d86ad0d9924e58f60dbd172a9784395f1a38
4
+ data.tar.gz: 59945b673957b063a2a01fcf869c1ee3a4e86d13419c71cbb7c751b0b6628fd5
5
+ SHA512:
6
+ metadata.gz: fd6e4de44cc52f8c05f33e8cc4519dec499551760a3a5022865b1f644a3303ef2e82b7d1955fd72e4c6b6d3d61c40810ebeb31bd8505c87a6060d00b01091620
7
+ data.tar.gz: 5f801ffb1439e4cdb3133a0301a606c26acb98f805349c3d9f1fd8c7420ef355e6aef8acd2a6551fe1bc44c43b4cea14600f7d5091bc6ea783206eb729c0a684
data/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ ## 0.7.1.3
2
+
3
+ - fix build-provenance and setup github releases
4
+
5
+ ## 0.7.1.2
6
+
7
+ - Ship precompiled native gems for common platforms (Linux, macOS, Windows),
8
+ so installing no longer rebuilds the IronCalc engine from source
9
+ - Publish via RubyGems Trusted Publishing with SigStore build provenance
10
+
11
+ ## 0.7.1.1
12
+
13
+ - Fix build: remove internal crate version
14
+
15
+ ## 0.7.1.0
16
+
17
+ - First release
18
+ - Ruby bindings for the IronCalc spreadsheet engine (engine 0.7.1)
19
+ - Raw API (`IronCalc::Model`) and user API (`IronCalc::UserModel`)
20
+ - Load/save xlsx and the internal icalc binary format
@@ -0,0 +1,191 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Jaap van der Plas
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
191
+
data/LICENSE-MIT.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jaap van der Plas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # IronCalc Ruby
2
+
3
+ Ruby bindings for [IronCalc](https://www.ironcalc.com/), a modern spreadsheet
4
+ engine written in Rust. Create, read and manipulate xlsx files — manage sheets,
5
+ set and read cell values, and evaluate formulas.
6
+
7
+ Built with [magnus](https://github.com/matsadler/magnus) /
8
+ [rb-sys](https://github.com/oxidize-rb/rb-sys), and modeled on the
9
+ [IronCalc Python bindings](https://github.com/ironcalc/ironcalc/tree/main/bindings/python).
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem "ironcalc"
17
+ ```
18
+
19
+ A Rust toolchain is required to build from source.
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ require "ironcalc"
25
+
26
+ # Raw API — call evaluate yourself.
27
+ model = IronCalc.create("model", "en", "UTC", "en")
28
+ model.set_user_input(0, 1, 1, "=21*2")
29
+ model.evaluate
30
+ model.get_formatted_cell_value(0, 1, 1) # => "42"
31
+ model.save_to_xlsx("out.xlsx")
32
+
33
+ # User API — auto-evaluates and tracks diffs for collaboration.
34
+ um = IronCalc.create_user_model("model", "en", "UTC", "en")
35
+ um.set_user_input(0, 1, 1, "=1+2")
36
+ um.get_formatted_cell_value(0, 1, 1) # => "3"
37
+ diffs = um.flush_send_queue # binary diff to send to peers
38
+ ```
39
+
40
+ Coordinates: `sheet` is a 0-based index; `row` and `column` are 1-based. Styles
41
+ are exchanged as plain Ruby hashes via `get_cell_style` / `set_cell_style`.
42
+
43
+ ### Top-level methods
44
+
45
+ `create`, `load_from_xlsx`, `load_from_icalc`, `load_from_bytes`,
46
+ `create_user_model`, `create_user_model_from_xlsx`,
47
+ `create_user_model_from_icalc`, `create_user_model_from_bytes`.
48
+
49
+ Errors raised by the engine surface as `IronCalc::Error`.
50
+
51
+ ## Relationship to the Python bindings
52
+
53
+ `ironcalc-ruby` is a thin binding over the same Rust engine as the
54
+ [IronCalc Python bindings](https://github.com/ironcalc/ironcalc/tree/main/bindings/python),
55
+ and deliberately mirrors their API. Both are compiled native extensions (Python
56
+ via **pyo3**, Ruby via **magnus** / **rb-sys**) exposing a module named
57
+ `ironcalc` backed by the IronCalc engine.
58
+
59
+ ### What's identical
60
+
61
+ - **Two APIs**: a raw `Model` (you call `evaluate` yourself) and a higher-level
62
+ `UserModel` (auto-evaluates and tracks diffs).
63
+ - **Top-level constructors**, same names and argument order
64
+ `(name_or_path, locale, tz, language_id)`: `create`, `load_from_xlsx`,
65
+ `load_from_icalc`, `load_from_bytes`, `create_user_model`,
66
+ `create_user_model_from_xlsx`, `create_user_model_from_icalc`,
67
+ `create_user_model_from_bytes`.
68
+ - **Method names and signatures** on `Model` / `UserModel` — `set_user_input`,
69
+ `get_formatted_cell_value`, `evaluate`, `insert_rows`, `set_column_width`,
70
+ `add_sheet`, `save_to_xlsx`, `to_bytes`, … (Python's `snake_case` is also
71
+ Ruby's convention, so they match exactly).
72
+ - **Coordinates**: `sheet` is a 0-based index; `row` and `column` are 1-based.
73
+ - **Semantics**: the same engine, so the same inputs produce the same results.
74
+
75
+ ```python
76
+ # Python
77
+ import ironcalc as ic
78
+ model = ic.create("model", "en", "UTC", "en")
79
+ model.set_user_input(0, 1, 1, "=21*2")
80
+ model.evaluate()
81
+ model.get_formatted_cell_value(0, 1, 1) # "42"
82
+ ```
83
+
84
+ ```ruby
85
+ # Ruby
86
+ require "ironcalc"
87
+ model = IronCalc.create("model", "en", "UTC", "en")
88
+ model.set_user_input(0, 1, 1, "=21*2")
89
+ model.evaluate
90
+ model.get_formatted_cell_value(0, 1, 1) # "42"
91
+ ```
92
+
93
+ ### Idiomatic Ruby adaptations
94
+
95
+ A few return and argument types follow Ruby conventions instead of being literal
96
+ ports:
97
+
98
+ | Concern | Python | Ruby |
99
+ |---|---|---|
100
+ | Module access | `ic.create(...)` | `IronCalc.create(...)` |
101
+ | Error type | `WorkbookError` | `IronCalc::Error` |
102
+ | Cell style | typed `Style` / `Font` / … objects | plain `Hash` (`get_cell_style` / `set_cell_style`) |
103
+ | Cell type | `CellType` enum | `Symbol` (`:number`, `:text`, …) |
104
+ | Worksheet properties | list of `SheetProperty` objects | array of `Hash`es (`:name`, `:state`, `:sheet_id`, `:color`) |
105
+ | Sheet dimensions | tuple `(min_row, max_row, min_col, max_col)` | 4-element `Array` |
106
+ | Binary blobs | `bytes` | binary `String` |
107
+ | Version | `ironcalc.__version__` | `IronCalc::VERSION` |
108
+
109
+ Rather than reconstruct Python's per-field style classes, Ruby exchanges styles
110
+ as plain hashes (serialized as JSON across the boundary). Everything else is kept
111
+ as close to the Python bindings as the two languages allow.
112
+
113
+ ## Development
114
+
115
+ ```sh
116
+ bundle install
117
+ bundle exec rake compile
118
+ bundle exec rake test
119
+ ```
120
+
121
+ ## License
122
+
123
+ Dual-licensed under [MIT](LICENSE-MIT.md) or [Apache-2.0](LICENSE-Apache-2.0.md),
124
+ matching IronCalc.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,81 @@
1
+ require "json"
2
+
3
+ # Ruby-side conveniences layered on top of the native classes. Styles cross the
4
+ # native boundary as JSON; here we expose them as plain Ruby hashes, mirroring
5
+ # the Node binding's serde-based approach.
6
+ module IronCalc
7
+ class Model
8
+ # Returns the cell style as a Hash with string keys (snake_case, matching the
9
+ # engine's serde field names), e.g.
10
+ # { "num_fmt" => "general", "font" => { "b" => false, ... }, ... }
11
+ #
12
+ # @param sheet [Integer] 0-based sheet index
13
+ # @param row [Integer] 1-based row
14
+ # @param column [Integer] 1-based column
15
+ # @return [Hash]
16
+ # @raise [IronCalc::Error]
17
+ def get_cell_style(sheet, row, column)
18
+ JSON.parse(get_cell_style_json(sheet, row, column))
19
+ end
20
+
21
+ # Sets the cell style from a Hash (snake_case keys) or a JSON string.
22
+ #
23
+ # @param sheet [Integer] 0-based sheet index
24
+ # @param row [Integer] 1-based row
25
+ # @param column [Integer] 1-based column
26
+ # @param style [Hash, String] the full style as a Hash or JSON string
27
+ # @return [void]
28
+ # @raise [IronCalc::Error]
29
+ def set_cell_style(sheet, row, column, style)
30
+ json = style.is_a?(String) ? style : JSON.generate(style)
31
+ set_cell_style_json(sheet, row, column, json)
32
+ end
33
+ end
34
+
35
+ class UserModel
36
+ # Returns the cell style as a Hash with string keys, like {Model#get_cell_style}.
37
+ #
38
+ # @param sheet [Integer] 0-based sheet index
39
+ # @param row [Integer] 1-based row
40
+ # @param column [Integer] 1-based column
41
+ # @return [Hash]
42
+ # @raise [IronCalc::Error]
43
+ def get_cell_style(sheet, row, column)
44
+ JSON.parse(get_cell_style_json(sheet, row, column))
45
+ end
46
+
47
+ # Sets the cell style from a Hash (or JSON string). The user model has no
48
+ # whole-style setter; styling is per-property via the engine's
49
+ # {#update_range_style} (mirroring the WASM binding). This convenience
50
+ # flattens the Hash and applies each leaf with {UserModel#update_range_style}.
51
+ #
52
+ # @param sheet [Integer] 0-based sheet index
53
+ # @param row [Integer] 1-based row
54
+ # @param column [Integer] 1-based column
55
+ # @param style [Hash, String] the style as a Hash or JSON string
56
+ # @return [void]
57
+ # @raise [IronCalc::Error]
58
+ def set_cell_style(sheet, row, column, style)
59
+ desired = style.is_a?(String) ? JSON.parse(style) : style
60
+ flatten_style(desired).each do |path, value|
61
+ update_range_style(sheet, row, column, path, value.to_s)
62
+ end
63
+ end
64
+
65
+ private
66
+
67
+ # Flattens a nested style Hash to engine style paths, e.g.
68
+ # { "font" => { "b" => true } } => { "font.b" => true }
69
+ # @api private
70
+ def flatten_style(hash, prefix = nil)
71
+ hash.each_with_object({}) do |(key, value), out|
72
+ path = prefix ? "#{prefix}.#{key}" : key.to_s
73
+ if value.is_a?(Hash)
74
+ out.merge!(flatten_style(value, path))
75
+ else
76
+ out[path] = value
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,501 @@
1
+ # Documentation-only stubs for the methods implemented in the native extension
2
+ # (ext/ironcalc, via magnus). YARD cannot see Rust source, so the public native
3
+ # API is described here with `@!method` directives. This file is NOT required at
4
+ # runtime — the real methods are defined by the compiled extension. Keep these
5
+ # stubs in sync with the Rust sources in ext/ironcalc/src (and `rake parity`).
6
+ #
7
+ # Coordinate convention everywhere: +sheet+ is a 0-based index; +row+ and
8
+ # +column+ are 1-based.
9
+
10
+ module IronCalc
11
+ # @!method create(name, locale, tz, language_id)
12
+ # @!scope class
13
+ # Creates an empty workbook using the raw {Model} API.
14
+ # @param name [String] workbook name
15
+ # @param locale [String] e.g. "en"
16
+ # @param tz [String] IANA timezone, e.g. "UTC"
17
+ # @param language_id [String] e.g. "en"
18
+ # @return [IronCalc::Model]
19
+ # @raise [IronCalc::Error]
20
+
21
+ # @!method load_from_xlsx(file_path, locale, tz, language_id)
22
+ # @!scope class
23
+ # Loads a workbook from an xlsx file into the raw {Model} API.
24
+ # @param file_path [String]
25
+ # @param locale [String]
26
+ # @param tz [String]
27
+ # @param language_id [String]
28
+ # @return [IronCalc::Model]
29
+ # @raise [IronCalc::Error]
30
+
31
+ # @!method load_from_icalc(file_name, language_id)
32
+ # @!scope class
33
+ # Loads a workbook from the internal binary icalc format.
34
+ # @param file_name [String]
35
+ # @param language_id [String]
36
+ # @return [IronCalc::Model]
37
+ # @raise [IronCalc::Error]
38
+
39
+ # @!method load_from_bytes(bytes, language_id)
40
+ # @!scope class
41
+ # Loads a workbook from icalc bytes (as produced by {Model#to_bytes}).
42
+ # @param bytes [String] binary icalc bytes
43
+ # @param language_id [String]
44
+ # @return [IronCalc::Model]
45
+ # @raise [IronCalc::Error]
46
+
47
+ # @!method create_user_model(name, locale, tz, language_id)
48
+ # @!scope class
49
+ # Creates an empty workbook using the recommended {UserModel} API.
50
+ # @param name [String]
51
+ # @param locale [String]
52
+ # @param tz [String]
53
+ # @param language_id [String]
54
+ # @return [IronCalc::UserModel]
55
+ # @raise [IronCalc::Error]
56
+
57
+ # @!method create_user_model_from_xlsx(file_path, locale, tz, language_id)
58
+ # @!scope class
59
+ # Loads an xlsx file into the {UserModel} API.
60
+ # @param file_path [String]
61
+ # @param locale [String]
62
+ # @param tz [String]
63
+ # @param language_id [String]
64
+ # @return [IronCalc::UserModel]
65
+ # @raise [IronCalc::Error]
66
+
67
+ # @!method create_user_model_from_icalc(file_name, language_id)
68
+ # @!scope class
69
+ # Loads an icalc file into the {UserModel} API.
70
+ # @param file_name [String]
71
+ # @param language_id [String]
72
+ # @return [IronCalc::UserModel]
73
+ # @raise [IronCalc::Error]
74
+
75
+ # @!method create_user_model_from_bytes(bytes, language_id)
76
+ # @!scope class
77
+ # Loads icalc bytes into the {UserModel} API.
78
+ # @param bytes [String] binary icalc bytes
79
+ # @param language_id [String]
80
+ # @return [IronCalc::UserModel]
81
+ # @raise [IronCalc::Error]
82
+
83
+ # The raw IronCalc API. You must call {#evaluate} yourself after changing
84
+ # inputs; misuse can leave the workbook in an inconsistent state. This mirrors
85
+ # the Python binding's `Model`. For most uses prefer {UserModel}, which
86
+ # auto-evaluates.
87
+ class Model
88
+ # @!method save_to_xlsx(file)
89
+ # Saves the workbook to an xlsx file. Fails if the file already exists.
90
+ # @param file [String]
91
+ # @return [void]
92
+ # @raise [IronCalc::Error]
93
+
94
+ # @!method save_to_icalc(file)
95
+ # Saves the workbook to the internal binary icalc format.
96
+ # @param file [String]
97
+ # @return [void]
98
+ # @raise [IronCalc::Error]
99
+
100
+ # @!method to_bytes
101
+ # Serializes the workbook to icalc bytes (load with {IronCalc.load_from_bytes}).
102
+ # @return [String] binary string
103
+
104
+ # @!method evaluate
105
+ # Recalculates the whole workbook. Call after {#set_user_input}.
106
+ # @return [void]
107
+
108
+ # @!method set_user_input(sheet, row, column, value)
109
+ # Sets a cell's raw input (a literal or a formula like "=A1+1").
110
+ # @param sheet [Integer]
111
+ # @param row [Integer]
112
+ # @param column [Integer]
113
+ # @param value [String]
114
+ # @return [void]
115
+ # @raise [IronCalc::Error]
116
+
117
+ # @!method clear_cell_contents(sheet, row, column)
118
+ # Clears a cell's contents (not its style).
119
+ # @param sheet [Integer]
120
+ # @param row [Integer]
121
+ # @param column [Integer]
122
+ # @return [void]
123
+ # @raise [IronCalc::Error]
124
+
125
+ # @!method get_cell_content(sheet, row, column)
126
+ # Returns the cell's content: the formula (e.g. "=A1+1") or literal text.
127
+ # @param sheet [Integer]
128
+ # @param row [Integer]
129
+ # @param column [Integer]
130
+ # @return [String]
131
+ # @raise [IronCalc::Error]
132
+
133
+ # @!method get_cell_type(sheet, row, column)
134
+ # Returns the cell type as a Symbol: +:number+, +:text+, +:logical_value+,
135
+ # +:error_value+, +:array+ or +:compound_data+.
136
+ # @param sheet [Integer]
137
+ # @param row [Integer]
138
+ # @param column [Integer]
139
+ # @return [Symbol]
140
+ # @raise [IronCalc::Error]
141
+
142
+ # @!method get_formatted_cell_value(sheet, row, column)
143
+ # Returns the cell's value formatted as displayed (number format applied).
144
+ # @param sheet [Integer]
145
+ # @param row [Integer]
146
+ # @param column [Integer]
147
+ # @return [String]
148
+ # @raise [IronCalc::Error]
149
+
150
+ # @!method get_cell_style_json(sheet, row, column)
151
+ # @api private
152
+ # JSON backing for `get_cell_style`. Prefer the Hash-returning wrapper.
153
+ # @return [String]
154
+
155
+ # @!method set_cell_style_json(sheet, row, column, style_json)
156
+ # @api private
157
+ # JSON backing for `set_cell_style`. Prefer the Hash-accepting wrapper.
158
+ # @return [void]
159
+
160
+ # @!method insert_rows(sheet, row, row_count)
161
+ # Inserts +row_count+ rows before +row+.
162
+ # @param sheet [Integer]
163
+ # @param row [Integer]
164
+ # @param row_count [Integer]
165
+ # @return [void]
166
+ # @raise [IronCalc::Error]
167
+
168
+ # @!method insert_columns(sheet, column, column_count)
169
+ # Inserts +column_count+ columns before +column+.
170
+ # @param sheet [Integer]
171
+ # @param column [Integer]
172
+ # @param column_count [Integer]
173
+ # @return [void]
174
+ # @raise [IronCalc::Error]
175
+
176
+ # @!method delete_rows(sheet, row, row_count)
177
+ # Deletes +row_count+ rows starting at +row+.
178
+ # @param sheet [Integer]
179
+ # @param row [Integer]
180
+ # @param row_count [Integer]
181
+ # @return [void]
182
+ # @raise [IronCalc::Error]
183
+
184
+ # @!method delete_columns(sheet, column, column_count)
185
+ # Deletes +column_count+ columns starting at +column+.
186
+ # @param sheet [Integer]
187
+ # @param column [Integer]
188
+ # @param column_count [Integer]
189
+ # @return [void]
190
+ # @raise [IronCalc::Error]
191
+
192
+ # @!method get_column_width(sheet, column)
193
+ # @param sheet [Integer]
194
+ # @param column [Integer]
195
+ # @return [Float] width in pixels
196
+ # @raise [IronCalc::Error]
197
+
198
+ # @!method get_row_height(sheet, row)
199
+ # @param sheet [Integer]
200
+ # @param row [Integer]
201
+ # @return [Float] height in pixels
202
+ # @raise [IronCalc::Error]
203
+
204
+ # @!method set_column_width(sheet, column, width)
205
+ # @param sheet [Integer]
206
+ # @param column [Integer]
207
+ # @param width [Float]
208
+ # @return [void]
209
+ # @raise [IronCalc::Error]
210
+
211
+ # @!method set_row_height(sheet, row, height)
212
+ # @param sheet [Integer]
213
+ # @param row [Integer]
214
+ # @param height [Float]
215
+ # @return [void]
216
+ # @raise [IronCalc::Error]
217
+
218
+ # @!method get_frozen_columns_count(sheet)
219
+ # @param sheet [Integer]
220
+ # @return [Integer]
221
+ # @raise [IronCalc::Error]
222
+
223
+ # @!method get_frozen_rows_count(sheet)
224
+ # @param sheet [Integer]
225
+ # @return [Integer]
226
+ # @raise [IronCalc::Error]
227
+
228
+ # @!method set_frozen_columns_count(sheet, count)
229
+ # @param sheet [Integer]
230
+ # @param count [Integer]
231
+ # @return [void]
232
+ # @raise [IronCalc::Error]
233
+
234
+ # @!method set_frozen_rows_count(sheet, count)
235
+ # @param sheet [Integer]
236
+ # @param count [Integer]
237
+ # @return [void]
238
+ # @raise [IronCalc::Error]
239
+
240
+ # @!method get_worksheets_properties
241
+ # Returns one Hash per sheet with symbol keys +:name+, +:state+,
242
+ # +:sheet_id+ and +:color+.
243
+ # @return [Array<Hash>]
244
+
245
+ # @!method set_sheet_color(sheet, color)
246
+ # @param sheet [Integer]
247
+ # @param color [String] hex color, e.g. "#FF0000"
248
+ # @return [void]
249
+ # @raise [IronCalc::Error]
250
+
251
+ # @!method add_sheet(name)
252
+ # Adds a new sheet with the given name.
253
+ # @param name [String]
254
+ # @return [void]
255
+ # @raise [IronCalc::Error]
256
+
257
+ # @!method new_sheet
258
+ # Adds a new sheet with an auto-generated name.
259
+ # @return [void]
260
+
261
+ # @!method delete_sheet(sheet)
262
+ # @param sheet [Integer]
263
+ # @return [void]
264
+ # @raise [IronCalc::Error]
265
+
266
+ # @!method rename_sheet(sheet, new_name)
267
+ # @param sheet [Integer]
268
+ # @param new_name [String]
269
+ # @return [void]
270
+ # @raise [IronCalc::Error]
271
+
272
+ # @!method get_sheet_dimensions(sheet)
273
+ # Returns +[min_row, max_row, min_column, max_column]+ over non-empty cells
274
+ # (an empty sheet returns +[1, 1, 1, 1]+).
275
+ # @param sheet [Integer]
276
+ # @return [Array(Integer, Integer, Integer, Integer)]
277
+ # @raise [IronCalc::Error]
278
+ end
279
+
280
+ # The recommended, higher-level IronCalc API. Auto-evaluates after every action
281
+ # and records diffs for collaboration ({#flush_send_queue} /
282
+ # {#apply_external_diffs}). Mirrors IronCalc's WebAssembly binding and is a
283
+ # superset of the Python binding's `UserModel`. Styling is per-property via
284
+ # {UserModel#update_range_style} (the Hash convenience {UserModel#set_cell_style}
285
+ # is layered on top).
286
+ class UserModel
287
+ # @!method save_to_xlsx(file)
288
+ # Saves the workbook to an xlsx file. Fails if the file already exists.
289
+ # @param file [String]
290
+ # @return [void]
291
+ # @raise [IronCalc::Error]
292
+
293
+ # @!method save_to_icalc(file)
294
+ # Saves the workbook to the internal binary icalc format.
295
+ # @param file [String]
296
+ # @return [void]
297
+ # @raise [IronCalc::Error]
298
+
299
+ # @!method to_bytes
300
+ # Serializes the workbook to icalc bytes.
301
+ # @return [String] binary string
302
+
303
+ # @!method apply_external_diffs(diffs)
304
+ # Applies a peer's diff blob (from {#flush_send_queue}) for collaboration.
305
+ # @param diffs [String] binary diff blob
306
+ # @return [void]
307
+ # @raise [IronCalc::Error]
308
+
309
+ # @!method flush_send_queue
310
+ # Returns and clears the queued diffs to broadcast to collaborators.
311
+ # @return [String] binary diff blob
312
+
313
+ # @!method evaluate
314
+ # Forces a recalculation. Usually unnecessary — the user model
315
+ # auto-evaluates after each action; exposed for parity.
316
+ # @return [void]
317
+
318
+ # @!method undo
319
+ # Undoes the last change.
320
+ # @return [void]
321
+ # @raise [IronCalc::Error]
322
+
323
+ # @!method redo
324
+ # Redoes the last undone change.
325
+ # @return [void]
326
+ # @raise [IronCalc::Error]
327
+
328
+ # @!method can_undo
329
+ # @return [Boolean]
330
+
331
+ # @!method can_redo
332
+ # @return [Boolean]
333
+
334
+ # @!method set_user_input(sheet, row, column, value)
335
+ # Sets a cell's raw input (literal or formula). Triggers recalculation.
336
+ # @param sheet [Integer]
337
+ # @param row [Integer]
338
+ # @param column [Integer]
339
+ # @param value [String]
340
+ # @return [void]
341
+ # @raise [IronCalc::Error]
342
+
343
+ # @!method clear_cell_contents(sheet, row, column)
344
+ # Clears a cell's contents (not its style).
345
+ # @param sheet [Integer]
346
+ # @param row [Integer]
347
+ # @param column [Integer]
348
+ # @return [void]
349
+ # @raise [IronCalc::Error]
350
+
351
+ # @!method get_cell_content(sheet, row, column)
352
+ # Returns the cell's content: formula or literal text.
353
+ # @param sheet [Integer]
354
+ # @param row [Integer]
355
+ # @param column [Integer]
356
+ # @return [String]
357
+ # @raise [IronCalc::Error]
358
+
359
+ # @!method get_cell_type(sheet, row, column)
360
+ # Returns the cell type as a Symbol (see {Model#get_cell_type}).
361
+ # @param sheet [Integer]
362
+ # @param row [Integer]
363
+ # @param column [Integer]
364
+ # @return [Symbol]
365
+ # @raise [IronCalc::Error]
366
+
367
+ # @!method get_formatted_cell_value(sheet, row, column)
368
+ # Returns the cell's value formatted as displayed.
369
+ # @param sheet [Integer]
370
+ # @param row [Integer]
371
+ # @param column [Integer]
372
+ # @return [String]
373
+ # @raise [IronCalc::Error]
374
+
375
+ # @!method get_cell_style_json(sheet, row, column)
376
+ # @api private
377
+ # JSON backing for `get_cell_style`. Prefer the Hash-returning wrapper.
378
+ # @return [String]
379
+
380
+ # @!method update_range_style(sheet, row, column, style_path, value)
381
+ # Sets a single style property on a cell, e.g. +update_range_style(0, 1, 1,
382
+ # "font.b", "true")+. This is the user model's styling primitive (mirrors
383
+ # the WASM binding); `set_cell_style` wraps it for whole-Hash convenience.
384
+ # @param sheet [Integer]
385
+ # @param row [Integer]
386
+ # @param column [Integer]
387
+ # @param style_path [String] dotted path, e.g. "font.b", "fill.fg_color"
388
+ # @param value [String]
389
+ # @return [void]
390
+ # @raise [IronCalc::Error]
391
+
392
+ # @!method insert_rows(sheet, row, row_count)
393
+ # @param sheet [Integer]
394
+ # @param row [Integer]
395
+ # @param row_count [Integer]
396
+ # @return [void]
397
+ # @raise [IronCalc::Error]
398
+
399
+ # @!method insert_columns(sheet, column, column_count)
400
+ # @param sheet [Integer]
401
+ # @param column [Integer]
402
+ # @param column_count [Integer]
403
+ # @return [void]
404
+ # @raise [IronCalc::Error]
405
+
406
+ # @!method delete_rows(sheet, row, row_count)
407
+ # @param sheet [Integer]
408
+ # @param row [Integer]
409
+ # @param row_count [Integer]
410
+ # @return [void]
411
+ # @raise [IronCalc::Error]
412
+
413
+ # @!method delete_columns(sheet, column, column_count)
414
+ # @param sheet [Integer]
415
+ # @param column [Integer]
416
+ # @param column_count [Integer]
417
+ # @return [void]
418
+ # @raise [IronCalc::Error]
419
+
420
+ # @!method get_column_width(sheet, column)
421
+ # @param sheet [Integer]
422
+ # @param column [Integer]
423
+ # @return [Float] width in pixels
424
+ # @raise [IronCalc::Error]
425
+
426
+ # @!method get_row_height(sheet, row)
427
+ # @param sheet [Integer]
428
+ # @param row [Integer]
429
+ # @return [Float] height in pixels
430
+ # @raise [IronCalc::Error]
431
+
432
+ # @!method set_column_width(sheet, column, width)
433
+ # @param sheet [Integer]
434
+ # @param column [Integer]
435
+ # @param width [Float]
436
+ # @return [void]
437
+ # @raise [IronCalc::Error]
438
+
439
+ # @!method set_row_height(sheet, row, height)
440
+ # @param sheet [Integer]
441
+ # @param row [Integer]
442
+ # @param height [Float]
443
+ # @return [void]
444
+ # @raise [IronCalc::Error]
445
+
446
+ # @!method get_frozen_columns_count(sheet)
447
+ # @param sheet [Integer]
448
+ # @return [Integer]
449
+ # @raise [IronCalc::Error]
450
+
451
+ # @!method get_frozen_rows_count(sheet)
452
+ # @param sheet [Integer]
453
+ # @return [Integer]
454
+ # @raise [IronCalc::Error]
455
+
456
+ # @!method set_frozen_columns_count(sheet, count)
457
+ # @param sheet [Integer]
458
+ # @param count [Integer]
459
+ # @return [void]
460
+ # @raise [IronCalc::Error]
461
+
462
+ # @!method set_frozen_rows_count(sheet, count)
463
+ # @param sheet [Integer]
464
+ # @param count [Integer]
465
+ # @return [void]
466
+ # @raise [IronCalc::Error]
467
+
468
+ # @!method get_worksheets_properties
469
+ # Returns one Hash per sheet with symbol keys +:name+, +:state+,
470
+ # +:sheet_id+ and +:color+.
471
+ # @return [Array<Hash>]
472
+
473
+ # @!method set_sheet_color(sheet, color)
474
+ # @param sheet [Integer]
475
+ # @param color [String] hex color, e.g. "#FF0000"
476
+ # @return [void]
477
+ # @raise [IronCalc::Error]
478
+
479
+ # @!method new_sheet
480
+ # Adds a new sheet with an auto-generated name.
481
+ # @return [void]
482
+ # @raise [IronCalc::Error]
483
+
484
+ # @!method delete_sheet(sheet)
485
+ # @param sheet [Integer]
486
+ # @return [void]
487
+ # @raise [IronCalc::Error]
488
+
489
+ # @!method rename_sheet(sheet, new_name)
490
+ # @param sheet [Integer]
491
+ # @param new_name [String]
492
+ # @return [void]
493
+ # @raise [IronCalc::Error]
494
+
495
+ # @!method get_sheet_dimensions(sheet)
496
+ # Returns +[min_row, max_row, min_column, max_column]+ over non-empty cells.
497
+ # @param sheet [Integer]
498
+ # @return [Array(Integer, Integer, Integer, Integer)]
499
+ # @raise [IronCalc::Error]
500
+ end
501
+ end
@@ -0,0 +1,3 @@
1
+ module IronCalc
2
+ VERSION = "0.7.1.3"
3
+ end
data/lib/ironcalc.rb ADDED
@@ -0,0 +1,11 @@
1
+ require_relative "ironcalc/version"
2
+
3
+ # Load the compiled native extension. Built gems place the shared library under
4
+ # a Ruby-version subdirectory; a locally compiled one sits directly in lib.
5
+ begin
6
+ require "ironcalc/#{RUBY_VERSION.to_f}/ironcalc_ruby"
7
+ rescue LoadError
8
+ require "ironcalc/ironcalc_ruby"
9
+ end
10
+
11
+ require_relative "ironcalc/model"
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ironcalc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.1.3
5
+ platform: aarch64-linux
6
+ authors:
7
+ - jvdp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-06-16 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ Ruby bindings for the IronCalc spreadsheet engine. Create, read and
15
+ manipulate xlsx files: manage sheets, set and read cell values, and
16
+ evaluate formulas.
17
+ email: jaap@vage-ideeen.nl
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - CHANGELOG.md
23
+ - LICENSE-Apache-2.0.md
24
+ - LICENSE-MIT.md
25
+ - README.md
26
+ - lib/ironcalc.rb
27
+ - lib/ironcalc/3.0/ironcalc_ruby.so
28
+ - lib/ironcalc/3.1/ironcalc_ruby.so
29
+ - lib/ironcalc/3.2/ironcalc_ruby.so
30
+ - lib/ironcalc/3.3/ironcalc_ruby.so
31
+ - lib/ironcalc/3.4/ironcalc_ruby.so
32
+ - lib/ironcalc/model.rb
33
+ - lib/ironcalc/native_methods.rb
34
+ - lib/ironcalc/version.rb
35
+ homepage: https://github.com/jvdp/IronCalc-Ruby
36
+ licenses:
37
+ - MIT OR Apache-2.0
38
+ metadata:
39
+ homepage_uri: https://www.ironcalc.com/
40
+ source_code_uri: https://github.com/jvdp/IronCalc-Ruby
41
+ bug_tracker_uri: https://github.com/jvdp/IronCalc-Ruby/issues
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: 3.5.dev
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.5.23
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Create, edit and evaluate Excel spreadsheets
64
+ test_files: []