Skip to content

Move dormant_capable? from Parser to cycle classes#73

Open
rymiwe wants to merge 1 commit intomainfrom
refactor/dormant-capable-on-cycle-class
Open

Move dormant_capable? from Parser to cycle classes#73
rymiwe wants to merge 1 commit intomainfrom
refactor/dormant-capable-on-cycle-class

Conversation

@rymiwe
Copy link

@rymiwe rymiwe commented Mar 20, 2026

Summary

Addresses jdowd's feedback from #69:

"I don't love that the dormant-capability is only revealed in Parser, but we should have a single pattern for this"

Each cycle class now declares its own dormant capability alongside recurring?:

def self.recurring? = true
def self.dormant_capable? = true   # EndOf, Within

Parser.dormant_capable_kinds now derives the list from the cycle classes instead of a hardcoded array. Adding a new dormant-capable cycle kind only requires declaring dormant_capable? on the class — no separate Parser edit needed.

Before

To make a cycle dormant-capable, you had to:

  1. Add behavior to the cycle class
  2. Also add its notation letter to Parser.dormant_capable_kinds = %w[E W]

After

Just declare it on the class:

def self.dormant_capable? = true

Test plan

  • All 179 existing specs pass (no new specs needed — pure refactor)
  • StandardRB clean

No behavior change — this is a mechanical refactor that makes cycle classes self-describing.

Each cycle class now declares its own dormant capability:

  def self.dormant_capable? = true   # EndOf, Within
  def self.dormant_capable? = false  # Cycle base (default)

Parser.dormant_capable_kinds now derives the list from
Cycle.cycle_handlers instead of a hardcoded array. This means
adding a new dormant-capable cycle kind only requires declaring
dormant_capable? on the class — no separate Parser edit needed.
@rymiwe rymiwe marked this pull request as ready for review March 20, 2026 06:07
@rymiwe rymiwe requested review from a team March 20, 2026 06:20
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