Skip to content

Add RBS signatures - #72

Open
ksss wants to merge 6 commits into
ruby:masterfrom
ksss:add-rbs-signatures
Open

ksss wants to merge 6 commits into
ruby:masterfrom
ksss:add-rbs-signatures

Conversation

@ksss

@ksss ksss commented Oct 27, 2026

Copy link
Copy Markdown

Ship the RBS type definitions with the gem, like base64 and bigdecimal, so that the signatures stay in sync with each released version. pstore is listed in ALUMNI_STDLIBS of ruby/rbs, which expects the gem to ship its own sig/ directory.

Changes

  • sig/pstore.rbs: based on ruby/rbs stdlib/pstore/0
    • Removed private methods and private constants, which are implementation details
    • Added PStore::Error
    • Added the thread_safe, ultra_safe and follow_symlink keyword arguments to PStore.new
    • PStore#fetch accepts a default value of any type, as in store.fetch(:nope, nil) of the documentation
    • Comments are generated from RDoc by rake rbs:annotate
  • test_sig/: type tests using the examples from the documentation, run by rake rbs:test
  • .github/workflows/sig.yml: runs rbs validate and rake rbs:test
  • Gemfile: add an optional sig group (rbs, rdoc)
  • pstore.gemspec: exclude test_sig/ from the package

How to run

BUNDLE_WITH=sig bundle install
BUNDLE_WITH=sig bundle exec rbs -I sig validate
BUNDLE_WITH=sig bundle exec rake rbs:test
BUNDLE_WITH=sig bundle exec rake rbs:annotate

🤖 Generated with Claude Code

ksss and others added 6 commits October 26, 2026 23:49
Ship the RBS type definitions with the gem, like base64 and bigdecimal,
so that the signatures stay in sync with each released version.

* sig/: copied as-is from ruby/rbs stdlib/pstore/0
* test_sig/: type tests restored from ruby/rbs test/stdlib/PStore_test.rb
  (removed in ruby/rbs@316e690b)
* Add `rake rbs:test` and a sig workflow
* Exclude test_sig/ from the gem package

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They are implementation details and not part of the public API.
Keep initialize since it defines the signature of new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add PStore::Error
* Add thread_safe, ultra_safe and follow_symlink keyword arguments
  to PStore.new
* Accept a default value of any type in PStore#fetch, as in
  `store.fetch(:nope, nil)` of the documentation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test the types of each method signature rather than its behavior,
using the examples from the documentation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generate the RBS comments from the RDoc of lib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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