class Haml::Compiler
def push_script(text, opts = {})
If `opts[:preserve_script]` is true, Haml::Helpers#find_and_flatten is run on
the scope object and the result to be added to `@buffer`.
Causes `text` to be evaluated in the context of
def push_script(text, opts = {}) return if @options.suppress_eval? args = %w[preserve_script in_tag preserve_tag escape_html nuke_inner_whitespace] args.map! {|name| opts[name.to_sym]} args << !block_given? << @options[:ugly] no_format = @options[:ugly] && !(opts[:preserve_script] || opts[:preserve_tag] || opts[:escape_html]) output_expr = "(#{text}\n)" static_method = "_hamlout.#{static_method_name(:format_script, *args)}" # Prerender tabulation unless we're in a tag push_merged_text '' unless opts[:in_tag] unless block_given? push_generated_script(no_format ? "#{text}\n" : "#{static_method}(#{output_expr});") concat_merged_text("\n") unless opts[:in_tag] || opts[:nuke_inner_whitespace] return end flush_merged_text push_silent "haml_temp = #{text}" yield push_silent('end', :can_suppress) unless @node.value[:dont_push_end] @precompiled << "_hamlout.buffer << #{no_format ? "haml_temp.to_s;" : "#{static_method}(haml_temp);"}" concat_merged_text("\n") unless opts[:in_tag] || opts[:nuke_inner_whitespace] || @options[:ugly] end