Class: Representative::Tilt::JsonTemplate
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Representative::Tilt::JsonTemplate
- Defined in:
- lib/representative/tilt_integration.rb
Instance Method Summary collapse
- #evaluate(scope, locals, &block) ⇒ Object
- #initialize_engine ⇒ Object
- #precompiled_template(locals) ⇒ Object
- #prepare ⇒ Object
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_engine ⇒ Object
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 |
#prepare ⇒ Object
36 37 |
# File 'lib/representative/tilt_integration.rb', line 36 def prepare end |