Skip to content

Refactor category property to getter in daily learning events#12

Merged
mjradwin merged 2 commits into
mainfrom
claude/add-category-property-D6s8n
Mar 27, 2026
Merged

Refactor category property to getter in daily learning events#12
mjradwin merged 2 commits into
mainfrom
claude/add-category-property-D6s8n

Conversation

@mjradwin
Copy link
Copy Markdown
Member

Summary

Refactored the category property from a constructor-assigned instance field to a getter method across all daily learning event classes. This change improves code maintainability by centralizing category definitions and reducing constructor complexity.

Key Changes

  • Made DailyLearningEvent and DailyChapterEvent abstract base classes
  • Converted category from an instance property to a getter method in DailyLearningEvent (returns undefined by default)
  • Removed category parameter from DailyChapterEvent constructor
  • Implemented category getter in all concrete event classes:
    • ArukhHaShulchanYomiEvent
    • ChofetzChaimEvent
    • DailyRambamEvent and DailyRambam3Event
    • DirshuAmudYomiEvent
    • KitzurShulchanAruchEvent
    • MishnaYomiEvent
    • NachYomiEvent
    • PerekYomiEvent
    • PirkeiAvotSummerEvent
    • PsalmsEvent
    • SeferHaMitzvotEvent
    • ShemiratHaLashonEvent
    • YerushalmiYomiEvent
    • DafYomiEvent, DafWeeklyEvent, TanakhYomiEvent
  • Removed category field assignment from all constructors
  • Removed unused category field from DafPageEvent

Implementation Details

  • The getter pattern allows subclasses to define their category as a constant string without requiring constructor parameters
  • This reduces boilerplate in constructors and makes the category definition more discoverable in the class definition
  • The base class getter returns undefined, allowing subclasses to optionally override it

https://claude.ai/code/session_01Pi9ATpcqnm1iHZmdAsXzBm

claude added 2 commits March 27, 2026 19:05
Add a `get category(): string | undefined` property getter to the
DailyLearningEvent base class returning undefined by default, documented
as the category name used as the location field in iCalendar event feeds.

Convert all subclasses that set `this.category = 'string'` in their
constructors to instead override the getter and return the string directly.
DailyChapterEvent, which receives category as a constructor parameter,
uses a private backing field with a getter override.

https://claude.ai/code/session_01Pi9ATpcqnm1iHZmdAsXzBm
Mark both classes abstract. Remove the category constructor parameter
from DailyChapterEvent and replace the private-field getter with
category getter overrides in NachYomiEvent ('Nach Yomi') and
PerekYomiEvent ('Perek Yomi').

https://claude.ai/code/session_01Pi9ATpcqnm1iHZmdAsXzBm
@mjradwin mjradwin merged commit 8423932 into main Mar 27, 2026
4 checks passed
@mjradwin mjradwin deleted the claude/add-category-property-D6s8n branch March 27, 2026 19:11
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.

2 participants