Class Markaby::Rails::TemplateHandler

  1. lib/markaby/rails/current.rb
Parent: ::ActionView::TemplateHandler

Methods

public instance

  1. compile
  2. render

Included modules

  1. ActionView::TemplateHandlers::Compilable

Attributes

view [RW]

Public instance methods

compile (template, local_assigns={})
[show source]
    # File lib/markaby/rails/current.rb, line 8
 8:       def compile(template, local_assigns={})
 9:         "__template_handler = Markaby::Rails::TemplateHandler.new\n__template_handler.view = self\n__template_handler.render(lambda {\n\#{template.source}\n}, local_assigns)\n"
10:       end
render (template, local_assigns = (template.respond_to?(:locals) ? template.locals : {}))
[show source]
    # File lib/markaby/rails/current.rb, line 19
19:       def render(template, local_assigns = (template.respond_to?(:locals) ? template.locals : {}))
20:         builder = RailsBuilder.new(instance_variables.merge(local_assigns), @view)
21:         @view.output_buffer = builder
22: 
23:         template.is_a?(Proc) ?
24:           builder.instance_eval(&template) :
25:           builder.instance_eval(template.source)
26: 
27:         builder.to_s
28:       end