xlsxrb 0.1.6 → 0.1.7
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 +10 -0
- data/README.md +27 -12
- data/Steepfile +1 -0
- data/docs/visual/VisualGallery.md +8 -0
- data/docs/wasm/ruby.wasm +0 -0
- data/lib/ruby_lsp/xlsxrb/addon.rb +43 -0
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +769 -0
- data/lib/xlsxrb/elements/cell.rb +98 -4
- data/lib/xlsxrb/elements/column.rb +22 -0
- data/lib/xlsxrb/elements/row.rb +81 -1
- data/lib/xlsxrb/elements/types.rb +36 -5
- data/lib/xlsxrb/elements/workbook.rb +73 -5
- data/lib/xlsxrb/elements/worksheet.rb +110 -1
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb.rb +530 -181
- data/sig/generated/xlsxrb/elements/cell.rbs +10 -1
- data/sig/generated/xlsxrb/elements/column.rbs +5 -0
- data/sig/generated/xlsxrb/elements/row.rbs +8 -1
- data/sig/generated/xlsxrb/elements/types.rbs +13 -5
- data/sig/generated/xlsxrb/elements/workbook.rbs +8 -1
- data/sig/generated/xlsxrb/elements/worksheet.rbs +7 -0
- data/sig/generated/xlsxrb.rbs +606 -236
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 305368e1e5925e21411db3a34effb2aa2fb59328bf0aca626762657a7c2291c4
|
|
4
|
+
data.tar.gz: 6878a769b5ac0aca48a301f7cfbc632f263ff4befb96157c16f4f58bc1ef627e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3b70b346fc5481c3242b45ada1135e0a13da6cbf9fd7db2f3a8f084c5560041a0f4187b2b8142da93fd88f12b769f50f6dd4abe75612c6b1fdb0856604721d8
|
|
7
|
+
data.tar.gz: 5e18aa8c063522115e1320c74d550402cd9020088239b4d3061de2736a50dcab42487e20f1cb7d1e291f8fe31461251ca62703b299d2bb41d83ad1d1c03c79c6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
- No unreleased changes.
|
|
3
3
|
|
|
4
|
+
## [0.1.7] - 2026-08-16
|
|
5
|
+
|
|
6
|
+
### Added
|
|
7
|
+
- Bundled native Ruby LSP Add-on (`RubyLsp::Xlsxrb::Addon`) for zero-configuration, context-aware method autocompletion and rich markdown documentation in VS Code and LSP-enabled editors for block arguments (`wb.`, `s.`, `sheet.`, `stream_writer.`, `stream_sheet.`).
|
|
8
|
+
- Comprehensive YARD documentation (`@param`, `@return`, `@example`) across all public APIs, builders, proxies, and elements.
|
|
9
|
+
|
|
10
|
+
### Developer Experience
|
|
11
|
+
- Enhanced `rbs-inline` type signatures across all facade methods and builder objects with automated RBS generation.
|
|
12
|
+
- Added VS Code Steep extension configuration for Dev Containers.
|
|
13
|
+
|
|
4
14
|
## [0.1.6] - 2026-08-15
|
|
5
15
|
|
|
6
16
|
### Added
|
data/README.md
CHANGED
|
@@ -82,8 +82,8 @@ Generate large files efficiently by writing data directly to the file stream:
|
|
|
82
82
|
```ruby
|
|
83
83
|
require "xlsxrb"
|
|
84
84
|
|
|
85
|
-
Xlsxrb.generate("large_output.xlsx") do |
|
|
86
|
-
|
|
85
|
+
Xlsxrb.generate("large_output.xlsx") do |stream_writer|
|
|
86
|
+
stream_writer.sheet("Sales Data") do |sheet|
|
|
87
87
|
sheet.row(["Date", "Amount", "Status"])
|
|
88
88
|
sheet.row([Date.today, 100, true])
|
|
89
89
|
sheet.column(0, width: 15.5)
|
|
@@ -97,7 +97,7 @@ Read rows one at a time without loading the entire file into memory:
|
|
|
97
97
|
require "xlsxrb"
|
|
98
98
|
|
|
99
99
|
Xlsxrb.foreach("large_file.xlsx") do |sheet|
|
|
100
|
-
sheet.
|
|
100
|
+
sheet.each_row do |row|
|
|
101
101
|
puts "Row #{row.index}: #{row.cells.map(&:value).join(', ')}"
|
|
102
102
|
end
|
|
103
103
|
end
|
|
@@ -108,17 +108,17 @@ end
|
|
|
108
108
|
`xlsxrb` provides a powerful, immutable-by-default API for modifying existing Excel files or building templates in-memory.
|
|
109
109
|
|
|
110
110
|
#### Modifying an Existing File
|
|
111
|
-
You can update specific cells or sheets using the functional `Xlsxrb.modify` API, which yields the parsed `Workbook`.
|
|
111
|
+
You can update specific cells or sheets using the functional `Xlsxrb.modify` API, which yields the parsed `Elements::Workbook`.
|
|
112
112
|
|
|
113
113
|
```ruby
|
|
114
114
|
require "xlsxrb"
|
|
115
115
|
|
|
116
|
-
# Create a
|
|
117
|
-
Xlsxrb.build { |
|
|
116
|
+
# Create a template.xlsx for this example
|
|
117
|
+
Xlsxrb.build { |builder| builder.sheet("Invoice") }.write("template.xlsx")
|
|
118
118
|
|
|
119
|
-
Xlsxrb.modify("template.xlsx", "output.xlsx") do |
|
|
120
|
-
|
|
121
|
-
# Update
|
|
119
|
+
Xlsxrb.modify("template.xlsx", "output.xlsx") do |workbook|
|
|
120
|
+
workbook.update_sheet("Invoice") do |sheet|
|
|
121
|
+
# Update specific cells (returns updated sheet)
|
|
122
122
|
sheet = sheet.update_cell("C4", value: "INV-10042")
|
|
123
123
|
sheet = sheet.update_cell("C5", value: Date.today)
|
|
124
124
|
|
|
@@ -134,16 +134,31 @@ end
|
|
|
134
134
|
You can directly apply inline styles or use Ranges for multiple columns without boilerplate:
|
|
135
135
|
|
|
136
136
|
```ruby
|
|
137
|
-
Xlsxrb.build do |
|
|
137
|
+
Xlsxrb.build do |builder|
|
|
138
138
|
# Use [] accessor for sheets
|
|
139
|
-
|
|
139
|
+
builder["Report"].row(
|
|
140
140
|
["ID", "Name", "Score", "Rank"],
|
|
141
141
|
# Apply 'header' style to first two columns, and bold inline style to the third
|
|
142
142
|
styles: { 0..1 => "header", 2 => { font: { bold: true, color: "red" } } }
|
|
143
143
|
)
|
|
144
144
|
|
|
145
145
|
# Set multiple column widths at once using Ranges
|
|
146
|
-
|
|
146
|
+
builder["Report"].column("A".."D", width: 15.0)
|
|
147
|
+
end
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### IDE Autocompletion & Ruby LSP Support
|
|
151
|
+
|
|
152
|
+
`xlsxrb` bundles a native **Ruby LSP Add-on** (`RubyLsp::Xlsxrb::Addon`) and full **RBS signatures**, enabling zero-configuration method autocompletion and rich Markdown documentation in VS Code and other LSP-enabled editors.
|
|
153
|
+
|
|
154
|
+
Whether you use standard descriptive block variable names (`|stream_writer|`, `|sheet|`, `|workbook|`) or short names (`|wb|`, `|s|`), your editor will automatically provide complete method suggestions and parameter hints:
|
|
155
|
+
|
|
156
|
+
```ruby
|
|
157
|
+
Xlsxrb.generate("output.xlsx") do |stream_writer| # or |wb|
|
|
158
|
+
stream_writer.sheet("Data") do |sheet| # or |s|
|
|
159
|
+
sheet.row(["Product", "Price"], styles: :bold)
|
|
160
|
+
sheet.auto_filter("A1:B100")
|
|
161
|
+
end
|
|
147
162
|
end
|
|
148
163
|
```
|
|
149
164
|
|
data/Steepfile
CHANGED
|
@@ -1426,6 +1426,14 @@ sheet.rows.each do |row|
|
|
|
1426
1426
|
end
|
|
1427
1427
|
```
|
|
1428
1428
|
|
|
1429
|
+
### Console Output
|
|
1430
|
+
|
|
1431
|
+
```text
|
|
1432
|
+
=== Read Validation ===
|
|
1433
|
+
Row 0: A1: "Format" (String), B1: "Value" (String)
|
|
1434
|
+
Row 1: A2: "Rich Text Cell" (String), B2: "Normal BOLD RED ITALIC BLUE" (String)
|
|
1435
|
+
```
|
|
1436
|
+
|
|
1429
1437
|
<hr/>
|
|
1430
1438
|
|
|
1431
1439
|
## Cell Times
|
data/docs/wasm/ruby.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ruby_lsp/addon"
|
|
4
|
+
require_relative "completion_listener"
|
|
5
|
+
require_relative "../../xlsxrb/version"
|
|
6
|
+
|
|
7
|
+
module RubyLsp
|
|
8
|
+
module Xlsxrb
|
|
9
|
+
# Ruby LSP Add-on for xlsxrb.
|
|
10
|
+
#
|
|
11
|
+
# [Context & Lifecycle Note]
|
|
12
|
+
# This add-on serves as a bridge/polyfill for current Ruby LSP environments.
|
|
13
|
+
# While xlsxrb ships with complete RBS signatures (`sig/generated/`), Ruby LSP's
|
|
14
|
+
# type inferrer does not yet perform automatic static type inference from method
|
|
15
|
+
# block signatures to block parameters (e.g., `Xlsxrb.generate do |wb|`).
|
|
16
|
+
#
|
|
17
|
+
# This add-on enables immediate out-of-the-box autocompletion and rich Markdown
|
|
18
|
+
# documentation across all public block arguments.
|
|
19
|
+
#
|
|
20
|
+
# As the Ruby tooling ecosystem evolves and Ruby LSP gains native block argument
|
|
21
|
+
# type resolution from gem RBS signatures in the future, this add-on will become
|
|
22
|
+
# redundant and can eventually be deprecated or removed.
|
|
23
|
+
class Addon < ::RubyLsp::Addon
|
|
24
|
+
def activate(global_state, _message_queue)
|
|
25
|
+
@global_state = global_state
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def deactivate; end
|
|
29
|
+
|
|
30
|
+
def name
|
|
31
|
+
"xlsxrb"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def version
|
|
35
|
+
::Xlsxrb::VERSION
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def create_completion_listener(response_builder, node_context, dispatcher, _uri = nil)
|
|
39
|
+
CompletionListener.new(response_builder, node_context, dispatcher, @global_state)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|