Skip to content

Add RBS for rubyXL 3.4#1006

Merged
github-actions[bot] merged 2 commits intoruby:mainfrom
RYOTA-KOBA:rubyXL/3.4.27
Feb 22, 2026
Merged

Add RBS for rubyXL 3.4#1006
github-actions[bot] merged 2 commits intoruby:mainfrom
RYOTA-KOBA:rubyXL/3.4.27

Conversation

@RYOTA-KOBA
Copy link
Contributor

Summary

Adds RBS type definitions for rubyXL 3.4, a gem for reading and writing Excel (.xlsx) files.

Defined classes

Class Description
RubyXL::SheetData Sparse array of rows; provides rows, [], size
RubyXL::Row Sparse array of cells; provides cells, [], size
RubyXL::Cell Cell value access and style modification (change_fill, change_font_bold, etc.)
RubyXL::Worksheet Sheet name, sheet_data, cell creation (add_cell), row/column styling
RubyXL::Workbook Workbook construction, worksheet access by index or name, stream, write
RubyXL::Parser Parse .xlsx from file path or IO/String buffer

Design decisions

  • Cell#value returns DateTime, not Date
    The internal num_to_date method adds to DateTime.new(1904, 1, 1) or DateTime.new(1899, 12, 31), so the return type is ::DateTime, not ::Date.

  • manifest.yaml declares date stdlib dependency
    rubyXL's gemspec only lists nokogiri and rubyzip as runtime dependencies. ::DateTime (used in Cell#value) lives in the date stdlib, which must be declared explicitly in manifest.yaml.

  • Workbook#write is included
    Documented in the README as a public API (workbook.write("path/to/file.xlsx")). Implemented as alias_method :write, :save in the source.

rubyXL is a gem for reading and writing Excel (.xlsx) files.
This commit adds type definitions for the most commonly used APIs
described in the README.

Defined classes:
- RubyXL::SheetData  — sparse array of rows with index access
- RubyXL::Row        — sparse array of cells with index access
- RubyXL::Cell       — cell value accessor and style-change methods
- RubyXL::Worksheet  — sheet name, cell creation, row/column styling
- RubyXL::Workbook   — workbook construction, worksheet access, I/O
- RubyXL::Parser     — parsing .xlsx files from path or buffer

Notable design decisions:
- Cell#value returns String | Integer | Float | DateTime | nil.
  The implementation (num_to_date) returns DateTime, not Date.
- manifest.yaml declares `date` stdlib dependency because rubyXL's
  gemspec does not list it, yet DateTime is used in the RBS.
- Workbook#write is included as it is a documented public API
  (alias of save), even though it is defined via alias_method.
@RYOTA-KOBA RYOTA-KOBA marked this pull request as ready for review February 22, 2026 09:55
@github-actions
Copy link

@RYOTA-KOBA Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

rubyXL

This RBS files are newly added.

You can merge this PR immediately if the CI passes.
Just comment /merge to merge this PR.

@RYOTA-KOBA
Copy link
Contributor Author

/merge

@github-actions github-actions bot merged commit 1acc2fd into ruby:main Feb 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant