Class: Tilt::MarkabyTemplate
- Inherits:
-
Template
show all
- Defined in:
- lib/vendor/tilt-1.4.1/lib/tilt/markaby.rb
Overview
Instance Attribute Summary
Attributes inherited from Template
#data, #file, #line, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Template
#allows_script?, #basename, #default_encoding, #eval_file, #initialize, #name, #read_template_file, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Class Method Details
.builder_class ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markaby.rb', line 7
def self.builder_class
@builder_class ||= Class.new(Markaby::Builder) do
def __capture_markaby_tilt__(&block)
__run_markaby_tilt__ do
text capture(&block)
end
end
end
end
|
.engine_initialized? ⇒ Boolean
17
18
19
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markaby.rb', line 17
def self.engine_initialized?
defined? ::Markaby
end
|
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markaby.rb', line 28
def evaluate(scope, locals, &block)
builder = self.class.builder_class.new({}, scope)
builder.locals = locals
if data.kind_of? Proc
(class << builder; self end).send(:define_method, :__run_markaby_tilt__, &data)
else
builder.instance_eval <<-CODE, __FILE__, __LINE__
def __run_markaby_tilt__
#{data}
end
CODE
end
if block
builder.__capture_markaby_tilt__(&block)
else
builder.__run_markaby_tilt__
end
builder.to_s
end
|
#initialize_engine ⇒ Object
21
22
23
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markaby.rb', line 21
def initialize_engine
require_template_library 'markaby'
end
|
25
26
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markaby.rb', line 25
def prepare
end
|