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.
8 9 10 |
# File 'lib/hamlit/compiler/script_compiler.rb', line 8 def initialize(identity) @identity = identity end |
Instance Method Details
#compile(node, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hamlit/compiler/script_compiler.rb', line 12 def compile(node, &block) case when node.children.empty? && RubyExpression.string_literal?(node.value[:text]) string_compile(node) when node.children.empty? && StaticAnalyzer.static?(node.value[:text]) static_compile(node) else dynamic_compile(node, &block) end end |