Class: ActionView::Template::Handlers::Mold

Inherits:
Object
  • Object
show all
Defined in:
lib/mold/handler.rb

Instance Method Summary collapse

Instance Method Details

#call(template) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mold/handler.rb', line 10

def call(template)
  source = if File.basename(template.identifier).starts_with?('_')
    'code.call'
  else
    defined?(Yajl) ? 'JSON.generate(code.call)' : 'ActiveSupport::JSON.encode(code.call)'
  end
  %{
    code = lambda{#{ template.source }}
    self.output_buffer = (#{ source })
  }
end