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.
This adds a tidy little spot to configure the default flipper instance. This has long been a thing people have to think about to use flipper. Rarely do people use multiple flipper instances in the same app, and if they want to they still can, but at least now it is wrapped up for most people.
default
is configured with a block. This makes it so it can either return a single instance no matter what or generate an instance safe for a thread, if necessary. A top level methodFlipper.instance
exists to memoize an instance of the default per thread.Each thread should get its own flipper instance with this, which should keep things thread safe without much work. This seemed easier than synchronizing everywhere. Since Flipper::DSL instances are light, it seemed like a fine trade off. Let me know if you have any different thoughts.
All of the DSL methods (save
group
which is already top level inFlipper
module) are now delegated toFlipper.instance
. This makes it so instead of doing:You can do:
...which is shorter and easier to remember. The list of methods delegated at this time is here.
I'll let this sit for a day or so. Please drop any comments. If I've already merged, feel free to continue to drop comments and I'll follow up with subsequent PRs to address.
fixes #243
xref #261