class Tilt::MarkabyTemplate
Markaby github.com/markaby/markaby
Public Class Methods
builder_class()
click to toggle source
# File lib/tilt/markaby.rb 9 def self.builder_class 10 @builder_class ||= Class.new(Markaby::Builder) do 11 def __capture_markaby_tilt__(&block) 12 __run_markaby_tilt__ do 13 text capture(&block) 14 end 15 end 16 end 17 end
Public Instance Methods
__capture_markaby_tilt__(&block)
click to toggle source
# File lib/tilt/markaby.rb 11 def __capture_markaby_tilt__(&block) 12 __run_markaby_tilt__ do 13 text capture(&block) 14 end 15 end
evaluate(scope, locals, &block)
click to toggle source
# File lib/tilt/markaby.rb 19 def evaluate(scope, locals, &block) 20 builder = self.class.builder_class.new({}, scope) 21 builder.locals = locals 22 23 if @data.kind_of? Proc 24 (class << builder; self end).send(:define_method, :__run_markaby_tilt__, &@data) 25 else 26 builder.instance_eval <<-CODE, __FILE__, __LINE__ 27 def __run_markaby_tilt__ 28 #{@data} 29 end 30 CODE 31 end 32 33 if block 34 builder.__capture_markaby_tilt__(&block) 35 else 36 builder.__run_markaby_tilt__ 37 end 38 39 builder.to_s 40 end