Added callback support
This commit is contained in:
@@ -224,7 +224,13 @@ editable_hook = (HookBuilder()
|
||||
```
|
||||
|
||||
### `when_custom(condition)`
|
||||
Use custom condition objects for complex logic.
|
||||
Use custom condition objects or callable predicates for complex logic.
|
||||
|
||||
The `when_custom()` method accepts either:
|
||||
- **Condition instances**: Objects that inherit from the `Condition` base class
|
||||
- **Callable predicates**: Functions that take a `HookContext` parameter and return a boolean
|
||||
|
||||
When a callable is provided, it's automatically wrapped in a `PredicateCondition` class internally.
|
||||
|
||||
```python
|
||||
class BusinessLogicCondition(Condition):
|
||||
|
||||
Reference in New Issue
Block a user