Class: Hamlit::Compiler::ScriptCompiler
- Defined in:
- lib/hamlit/compiler/script_compiler.rb
Instance Method Summary collapse
- #compile(node, &block) ⇒ Object
-
#initialize(identity) ⇒ ScriptCompiler
constructor
A new instance of ScriptCompiler.
Constructor Details
#initialize(identity) ⇒ ScriptCompiler
Returns a new instance of ScriptCompiler.
9 10 11 |
# File 'lib/hamlit/compiler/script_compiler.rb', line 9 def initialize(identity) @identity = identity end |
Instance Method Details
#compile(node, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hamlit/compiler/script_compiler.rb', line 13 def compile(node, &block) no_children = node.children.empty? case when no_children && node.value[:escape_interpolation] compile_interpolated_plain(node) when no_children && RubyExpression.string_literal?(node.value[:text]) delegate_optimization(node) when no_children && StaticAnalyzer.static?(node.value[:text]) static_compile(node) else dynamic_compile(node, &block) end end |