Conversation
jaymzh
approved these changes
Sep 26, 2026
jaymzh
force-pushed
the
fix-is-default-block-defaults
branch
from
September 27, 2026 22:20
aa40769 to
b3b6d8f
Compare
is_default? compared the current value against default_value, which is always nil when the default is a block. Setting an option to the value its block computes reported false, and setting it to nil reported true. Compare against the computed default instead. Signed-off-by: Tim Smith <tsmith84@proton.me>
tas50
force-pushed
the
fix-is-default-block-defaults
branch
from
September 28, 2026 02:03
b3b6d8f to
c384eaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is_default?compared the stored value againstdefault_value, which is alwaysnilwhen an option's default is a block. Withdefault(:attr) { x * 2 }:attrto the value the block computes returnedfalseattrtonilreturnedtrueIt now compares against
Configurable#default, which evaluates the block (or returns the static default).Tests
Added specs under "When config has a default value block" covering unset, set to the computed value, set to
nil, and set to another value. The two broken cases failed before the change. The full suite passes (160 examples) and cookstyle is clean.