class Slimi::Filters::OutputProtector

@api private

Public Instance Methods

call(exp) click to toggle source
Calls superclass method
# File lib/slimi/filters/embedded.rb, line 37
def call(exp)
  @protect = []
  @collected = ''
  @tag = "%#{object_id.abs.to_s(36)}%"
  super(exp)
  @collected
end
on_slimi_output(escape, text, content) click to toggle source
# File lib/slimi/filters/embedded.rb, line 50
def on_slimi_output(escape, text, content)
  @collected << @tag
  @protect << [:slimi, :output, escape, text, content]
  nil
end
on_static(text) click to toggle source
# File lib/slimi/filters/embedded.rb, line 45
def on_static(text)
  @collected << text
  nil
end
unprotect(text) click to toggle source
# File lib/slimi/filters/embedded.rb, line 56
def unprotect(text)
  block = [:multi]
  while text =~ /#{@tag}/
    block << [:static, Regexp.last_match.pre_match]
    block << @protect.shift
    text = Regexp.last_match.post_match
  end
  block << [:static, text]
end