- Introduce
define_hook .., scope: ->{}
option. This allows changing the callback execution context per callback. Many thanks to @doudou for pushing this.
- Same as 0.3.6 but we wanna indicate an internal change (using uber).
- Use
Uber::Options::Value
for evaluating callbacks, now that we have that gem.
- Fixing bug where
uninitialized constant Hooks
was thrown when using InheritableAttribute exclusively. Thanks to @haswalt for reporting.
- Removing
InheritableAttribute
as we use uber'sInheritableAttr
now.
- Fix a bug where the hook writer method (e.g.
#after_dark
) wasn't available on the instance even whenInstanceHooks
was included.
- Added
Hooks::InstanceHooks
to add hooks and/or callbacks on instance level. Thanks to @mpapis for that suggestion.
- Fix a bug, string hook names are now treated as symbols.
- The callback chain can now be halted by configuring the hook as
halts_on_falsey: true
and returningnil
orfalse
from the callback. - Internal refactorings: hooks are now encapsulated in
Hook
instances and run their callback chains.
#run_hook
now returns the list of callback results.
- You can now pass multiple hook names to
#define_hooks
.
h3. Changes
- Callback blocks are now executed on the instance using
instance_exec
. If you need to access the class (former context) useself.class
.
- An uninitialized
inheritable_attr
doesn't crash since it is not cloned anymore. Note that an uncloneable attribute value still causes an exception.