Skip to content

Extract reflection-based resolve! argument passing - #531

Merged
radar merged 1 commit into
masterfrom
pr11-resolve-with-args
Apr 23, 2026
Merged

Extract reflection-based resolve! argument passing#531
radar merged 1 commit into
masterfrom
pr11-resolve-with-args

Conversation

@radar

@radar radar commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Summary

Four resolve! implementations in the action layer duplicated the same introspection block: get .method(:resolve!).parameters, build an args hash conditionally, call resolve!(**args). This PR extracts that into a ResolvesWithArgs module with a single resolve_with_args(receiver, **available) method.

Changes

  • New lib/magic/resolves_with_args.rbMagic::ResolvesWithArgs module with private resolve_with_args
  • Action includes ResolvesWithArgs (covers Cast, ActivateAbility, ActivateLoyaltyAbility)
  • Cast::Mode includes Magic::ResolvesWithArgs directly (doesn't inherit from Action)
  • All four resolve! methods replaced with single-line or 2–3 line calls to resolve_with_args

Test plan

  • All 534 existing tests pass unchanged

🤖 Generated with Claude Code

Four action classes (Cast, ActivateAbility, ActivateLoyaltyAbility,
Cast::Mode) each duplicated the same .method(:resolve!).parameters
introspection block. A single ResolvesWithArgs module replaces all four
with resolve_with_args(receiver, **available) which filters the available
pool to only the keywords the method signature declares.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@radar
radar merged commit 21e024c into master Apr 23, 2026
1 check 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