Class: Wunderbar::Rails::JsonHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/wunderbar/rails.rb

Class Method Summary collapse

Class Method Details

.call(template) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/wunderbar/rails.rb', line 27

def self.call(template)
  %{
    compiled = Proc.new {#{template.source}}
    x = Wunderbar::JsonBuilder.new(self);
    instance_variables.each do |var|
      x.instance_variable_set var, instance_variable_get(var)
    end
    x.instance_eval(&compiled)
    x.target!
  }.strip # take care to preserve line numbers in original source
end