Skip to content

Commit

Permalink
contextualize value before invoking to_liquid
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmichaelgo committed Jan 22, 2024
1 parent 28f31d0 commit dd9921a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/liquid_c/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ inline static VALUE value_to_liquid_and_set_context(VALUE value, VALUE context_t
if (klass == rb_cString || klass == rb_cArray || klass == rb_cHash)
return value;

if (rb_respond_to(value, id_set_context))
rb_funcall(value, id_set_context, 1, context_to_set);

value = rb_funcall(value, id_to_liquid, 0);

if (rb_respond_to(value, id_set_context))
Expand Down

0 comments on commit dd9921a

Please sign in to comment.