Skip to content

Declare Singleton::SingletonInstanceMethods - #3037

Open
infiton wants to merge 1 commit into
ruby:masterfrom
infiton:rxc/declare-singleton-instance-methods
Open

Declare Singleton::SingletonInstanceMethods#3037
infiton wants to merge 1 commit into
ruby:masterfrom
infiton:rxc/declare-singleton-instance-methods

Conversation

@infiton

@infiton infiton commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Declare the internal Singleton::SingletonInstanceMethods module in the singleton stdlib signatures.

Ruby 3.4 and later expose this module as part of Singleton's implementation. Reflection-based signature generators can therefore produce declarations such as:

class Registry
  include Singleton::SingletonInstanceMethods
end

RBS currently treats this as an unknown mixin because only the related Singleton::SingletonClassMethods name is declared.

The new declaration is intentionally empty. Its methods are already represented directly on Singleton; registering the name prevents mechanically generated signatures from failing validation. This matches the existing treatment of SingletonClassMethods, added in #978.

Tests

2 tests, 9 assertions, 0 failures, 0 errors

The singleton library signatures also pass rbs validate.

Ruby 3.4 and later expose this internal module, and mechanically generated signatures can reference it. Register the module name just as RBS already does for SingletonClassMethods.
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