class Filters::DeferJS

Public Instance Methods

compile(node) click to toggle source
# File lib/rbbt/rest/common/misc.rb, line 330
    def compile(node)
      text = node.value[: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
      node.value[:text] = defer_text
      compile_with_tilt(node, 'haml')
    end
render(text) click to toggle source
# File lib/rbbt/rest/common/misc.rb, line 372
                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