liquid icon indicating copy to clipboard operation
liquid copied to clipboard

Drop Protocol - `to_number` / `__int__`

Open jg-rp opened this issue 2 years ago • 0 comments

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.

jg-rp avatar Mar 15 '22 06:03 jg-rp