Module: Haml::Filters::DeferJS

Includes:
Base
Defined in:
lib/rbbt/rest/common/misc.rb

Instance Method Summary collapse

Instance Method Details

#render(text) ⇒ Object



328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/rbbt/rest/common/misc.rb', line 328

def render(text)
  step_path = Thread.current["step_path"]
  text = "" if text.nil?
  defer_text =<<-EOF
%script
:plain
  defer(function(step_path){

#{text.gsub(/^/,"      ")}
  }, '#{step_path}')
EOF
  Haml::Engine.new(defer_text).to_html 
end