class ComponentEmbeddedRuby::RailsHandler

Public Class Methods

call(template, source = nil) click to toggle source
# File lib/component_embedded_ruby/rails_handler.rb, line 5
    def self.call(template, source = nil)
      source ||= template.source

      template_source = Template.new(
        source,
        safe_append_method: "safe_append=",
        unsafe_append_method: "append=",
        output_var_name: "@output_buffer"
      ).to_ruby

      <<~RUBY
        @output_buffer = ActionView::OutputBuffer.new('')
        #{template_source}
      RUBY
    end