Skip to content

Module: module_exec, singleton_class?, public_instance_method, set_temporary_name - #467

Merged
tannevaled merged 1 commit into
mainfrom
feat/cluster37
Aug 26, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/cluster37

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Adds four missing Module reflection methods (core/module had these as
NoMethodError):

  • module_exec is Module#class_exec (the block runs with the module as
    self and receives the given arguments).
  • singleton_class? reports whether the receiver is a singleton class — a
    per-object singleton or a class metaclass — tracked by a new isSingleton flag
    set wherever a singleton class is created.
  • public_instance_method returns an UnboundMethod like
    #instance_method, but raises NameError when the resolved method is private
    or protected.
  • set_temporary_name gives an anonymous module a non-permanent name (or
    clears it with nil), rejecting a permanently-named module, an empty name, and
    any name that reads as a constant or a constant path, exactly as MRI does.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
ratchet floor rises 15770 → 15790 (language+core now 15857 passing, +23, zero
regressions in a deterministic per-file sweep).

🤖 Generated with Claude Code

…mporary_name

Add four missing Module reflection methods:

- module_exec is Module#class_exec (the block runs with the module as self and
  receives the given arguments).
- singleton_class? reports whether the receiver is a singleton class — a
  per-object singleton or a class metaclass — tracked by a new isSingleton flag
  set wherever a singleton class is created.
- public_instance_method returns an UnboundMethod like #instance_method, but
  raises NameError when the resolved method is private or protected.
- set_temporary_name gives an anonymous module a non-permanent name (or clears it
  with nil), rejecting a permanently-named module, an empty name, and any name
  that reads as a constant or constant path, exactly as MRI does.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
floor rises 15770 -> 15790 (language+core +21).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 0d0e243 into main Aug 26, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/cluster37 branch August 26, 2026 22:47
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