liquid
liquid copied to clipboard
Drop Protocol - `to_number` / `__int__`
In addition to to_liquid_value
(allows drops to behave like a Liquid primitive value inside some expressions), Ruby Liquid uses to_number
to allow drops to work with filters that expect numbers as arguments.
The same effect can be achieved in Python Liquid using an __int__
and/or __float__
method.
Python Liquid's documentation for drop objects needs to be expanded to cover this use case.