class Slim::Translator::StaticTranslator
Public Class Methods
Source
# File lib/slim/translator.rb, line 60 def initialize(opts = {}) super @translate = eval("proc {|string| #{options[:tr_fn]}(string) }") end
Calls superclass method
Public Instance Methods
Source
# File lib/slim/translator.rb, line 65 def call(exp) @text, @captures = ''.dup, [] result = compile(exp) text = @translate.call(@text) while text =~ /%(\d+)/ result << [:static, $`] << @captures[$1.to_i - 1] text = $' end result << [:static, text] end
Source
# File lib/slim/translator.rb, line 82 def on_slim_output(escape, code, content) @captures << [:slim, :output, escape, code, content] @text << "%#{@captures.size}" [:multi] end
Source
# File lib/slim/translator.rb, line 77 def on_static(text) @text << text [:multi] end