Class: EsiForRack::Node::Include
Constant Summary
IncludeFailedError
Instance Attribute Summary
#context, #node
Instance Method Summary
collapse
#execute_in_place!, #init
Instance Method Details
#continue_on_error? ⇒ Boolean
29
30
31
|
# File 'lib/esi_for_rack/node.rb', line 29
def continue_on_error?
node['onerror'] == 'continue'
end
|
#execute ⇒ Object
33
34
35
36
37
|
# File 'lib/esi_for_rack/node.rb', line 33
def execute
context.lookup(resolved_src) or
(resolved_alt && context.lookup(resolved_alt)) or
(!continue_on_error? && raise(IncludeFailedError.new)) or nil
end
|
#resolved_alt ⇒ Object
25
26
27
|
# File 'lib/esi_for_rack/node.rb', line 25
def resolved_alt
EsiAttributeLanguage::SimpleGrammar.parse(@node['alt']).execute(context.resolver) if @node['alt']
end
|
#resolved_src ⇒ Object
21
22
23
|
# File 'lib/esi_for_rack/node.rb', line 21
def resolved_src
EsiAttributeLanguage::SimpleGrammar.parse(@node['src']).execute(context.resolver)
end
|