Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default filter #149

Closed
mraln opened this issue Oct 17, 2012 · 1 comment
Closed

Default filter #149

mraln opened this issue Oct 17, 2012 · 1 comment

Comments

@mraln
Copy link

mraln commented Oct 17, 2012

Hi,

today I needed a default filter to use in all variables (in this case the :escape filter to prevent XSS), but I have not found how to do this in liquid template, so I make this monkey patch:

module Liquid
  class Variable
    origin_initialize = instance_method(:initialize)

    define_method(:initialize) do |markup|
      origin_initialize.bind(self).(markup)
      @filters << [:escape, []]
    end
  end
end

there are some way to do this without this ugly patch???

thx

@phoet
Copy link
Contributor

phoet commented Jul 23, 2014

please use StackOverflow for such questions.

@phoet phoet closed this as completed Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants