Class: Representative::Tilt::JsonTemplate

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/representative/tilt_integration.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



39
40
41
42
43
44
# File 'lib/representative/tilt_integration.rb', line 39

def evaluate(scope, locals, &block)
  r = Representative::Json.new
  locals[:r] = r
  super(scope, locals, &block)
  r.to_json
end

#initialize_engineObject



31
32
33
34
# File 'lib/representative/tilt_integration.rb', line 31

def initialize_engine
  return if defined?(Representative::Json)
  require_template_library 'representative/json'
end

#precompiled_template(locals) ⇒ Object



46
47
48
# File 'lib/representative/tilt_integration.rb', line 46

def precompiled_template(locals)
  data.to_str
end

#prepareObject



36
37
# File 'lib/representative/tilt_integration.rb', line 36

def prepare
end