class Tilt::MarkabyTemplate

Markaby github.com/markaby/markaby

Public Class Methods

builder_class() click to toggle source
   # File lib/tilt/markaby.rb
 8 def self.builder_class
 9   @builder_class ||= Class.new(Markaby::Builder) do
10     def __capture_markaby_tilt__(&block)
11       __run_markaby_tilt__ do
12         text capture(&block)
13       end
14     end
15   end
16 end

Public Instance Methods

__capture_markaby_tilt__(&block) click to toggle source
   # File lib/tilt/markaby.rb
10 def __capture_markaby_tilt__(&block)
11   __run_markaby_tilt__ do
12     text capture(&block)
13   end
14 end
evaluate(scope, locals, &block) click to toggle source
   # File lib/tilt/markaby.rb
21     def evaluate(scope, locals, &block)
22       builder = self.class.builder_class.new({}, scope)
23       builder.locals = locals
24 
25       if data.kind_of? Proc
26         (class << builder; self end).send(:define_method, :__run_markaby_tilt__, &data)
27       else
28         builder.instance_eval <<-CODE, __FILE__, __LINE__
29           def __run_markaby_tilt__
30             #{data}
31           end
32         CODE
33       end
34 
35       if block
36         builder.__capture_markaby_tilt__(&block)
37       else
38         builder.__run_markaby_tilt__
39       end
40 
41       builder.to_s
42     end
prepare() click to toggle source
   # File lib/tilt/markaby.rb
18 def prepare
19 end