Repository navigation
Add NoBacksies, for callbacks defined with blocks - #353
Merged
Merged
Conversation
From the NoBacksies gem, as a standard library loaded with require 'facets/no_backsies'. The ten callback modules are generated from a list. Fixed along the way: super was called once for each callback and not at all when there was none; a subclass's callbacks were added to its superclass's lists; a missing constant gave the list of callbacks. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Brings the NoBacksies gem into Facets as a standard library, loaded with
require 'facets/no_backsies'. It is not loaded byrequire 'facets'.What is the same
callback,callbacks,callback_expressandcallback_invoke, and the:once,:safeand:superlessoptions.NoBacksies::Callbacksand the module for each callback (NoBacksies::MethodAddedand so on).What is different
include NoBacksiesworks, and is the same as includingNoBacksies::Callbacks. The gem's README used it in an example, but there it did nothing.callbackraises ArgumentError without a block.callback_expresswith a block restores the setting when the block raises.Fixes
superwas called once for each callback, and not at all when no callback was defined or the callbacks were switched off. It is now called once after the callbacks, and alone when none run.const_missingnow raises unless a callback supplies the constant, and returns what the callback returns. Itssuperis left for the callback to call, as the gem's documentation said.24 tests. The whole suite passes (1568 tests; the 4 pending were pending before).
🤖 Generated with Claude Code