mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 00:40:40 -07:00
The LR module provides all helper methods for compiled templates. It is loaded into the sandbox BEFORE lock!, so helpers are defined once and shared by all templates. Helpers include: - Type conversion: to_s, to_number, to_integer - Output: output (handles nil, arrays, BigDecimal formatting) - Lookup: lookup (hash/array access, Drop context support) - Encoding: escape_html, url_encode/decode, base64_encode/decode - Filters: truncate, truncatewords, slice, date, default, etc. Method references to CGI, Base64, BigDecimal are captured at load time, enabling safe use of these libraries within the sandbox. Design principle: Maximize work in pre-loaded runtime, minimize generated template code.