Simplify configuration with Scientist::Experiment.register convenience method #104
Conversation
2 similar comments
|
Ninja edit: Fixed CI failures and rewrote commit messages. Note that two out of four CI failures were caused by the auto-configuration "magic" I introduced in the second commit of this PR. This meant that in order to get the tests to pass, I had to add a line to the test setup to revert that "magic". If the maintainers find this change of behavior unacceptable, I'd be happy to roll this PR back by one commit. |
|
I would like to see this as well, especially with the readme updates with the named arg corrections. |
|
Anything I can do to help get this merged? |
|
I like the idea of a class method to set the default experiment rather than overriding I was initially concerned about automatically registering upon module inclusion since it could lead to require-time ordering issues if there are multiple base experiments. Since |
|
Good point; I'm on board! |
|
Thanks! I've released this as |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

I thought it was kind of clumsy to have to override
Scientist::Experiment.newwhen configuring Scientist, so I created aScientist::Experiment.registermethod to reduce the last five lines of configuration down to one.In the second commit on this PR, I automate the registration of new experiments via a
self.includedcallback, meaning that last line of configuration can be removed entirely.I believe these changes should be fully backward-compatible with the previous API, since the original approach was to manually override
Scientist::Experiment.newanyway.