Class: ActionView::Template::Handlers::Bldr

Inherits:
Object
  • Object
show all
Defined in:
lib/action_view/template/handlers/bldr.rb

Class Method Summary collapse

Class Method Details

.call(template, opts = {}) ⇒ String

Returns the rendered ruby code string to render the template.

Parameters:

  • template (ActionView::Template)

    the template instance

Returns:

  • (String)

    the rendered ruby code string to render the template



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/action_view/template/handlers/bldr.rb', line 6

def self.call(template, opts = {})
  source = if template.source.empty?
    File.read(template.identifier)
  else
    template.source
  end

  %{
    node = ::Bldr::Node.new(nil, parent: self, root: true) {
      #{source}
    }
    MultiJson.encode node.result
  }
end