class Slim::OutputProtector

@api private

Public Instance Methods

call(exp) click to toggle source
Calls superclass method
# File lib/slim/embedded.rb, line 32
def call(exp)
  @protect = []
  @collected = ''
  super(exp)
  @collected
end
on_slim_output(escape, text, content) click to toggle source
# File lib/slim/embedded.rb, line 44
def on_slim_output(escape, text, content)
  @collected << "pro#{@protect.size}tect"
  @protect << [:slim, :output, escape, text, content]
  nil
end
on_static(text) click to toggle source
# File lib/slim/embedded.rb, line 39
def on_static(text)
  @collected << text
  nil
end
unprotect(text) click to toggle source
# File lib/slim/embedded.rb, line 50
def unprotect(text)
  block = [:multi]
  while text =~ /pro(\d+)tect/
    block << [:static, $`]
    block << @protect[$1.to_i]
    text = $'
  end
  block << [:static, text]
end