• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dblock / ruby-enum
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: dblock/coveralls-github-token
DEFAULT BRANCH: master
Repo Added 30 Dec 2025 05:05PM UTC
Files 7
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH fix-subclass-no-defines
branch: fix-subclass-no-defines
CHANGE BRANCH
x
Reset
  • fix-subclass-no-defines
  • HEAD
  • dblock/coveralls-github-token
  • document-performance
  • fix-values-override-issue-62
  • master
  • memoize-enum-hash
  • rename-ruby-namespace
  • replace-code-climate-with-coveralls
  • ruby-4.0
  • subclass-inherited-values
  • update-copyright-year

15 Aug 2026 01:05AM UTC coverage: 100.0%. Remained the same
#18

Pull #58

dblock
Fix NoMethodError when a subclass defines no enums of its own

Ruby::Enum's class methods (keys, values, key?, value?, key, value,
to_h, parse, each) relied directly on @_enum_hash/@_enums_by_value
instance variables, which are only set the first time define is
called. A subclass that includes Ruby::Enum only through inheritance
and never calls define itself never gets these ivars set, so calling
any of the above methods raised NoMethodError on nil.

Introduces private _enum_hash/_enums_by_value reader methods that
default to an empty hash, and uses them everywhere instead of the raw
instance variables.

Closes #49.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pull Request #58: Fix NoMethodError on enum methods when subclass defines no enums of its own

18 of 18 new or added lines in 1 file covered. (100.0%)

152 of 152 relevant lines covered (100.0%)

6.51 hits per line

Relevant lines Covered
Build:
Build:
152 RELEVANT LINES 152 COVERED LINES
6.51 HITS PER LINE
Source Files on fix-subclass-no-defines
  • Tree
  • List 8
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
#18 fix-subclass-no-defines Fix NoMethodError when a subclass defines no enums of its own Ruby::Enum's class methods (keys, values, key?, value?, key, value, to_h, parse, each) relied directly on @_enum_hash/@_enums_by_value instance variables, which are only set the first ... Pull #58 15 Aug 2026 01:06AM UTC dblock
100.0
See All Builds (51)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc