Sha256: e923dcbbdd235b3f979e4bda5f5b4cbbebe44206d097c3d0bd972952008a6544
Contents?: true
Size: 1.05 KB
Versions: 21
Compression:
Stored size: 1.05 KB
Contents
# @Opulent module Opulent # @Compiler class Compiler # Evaluate the embedded ruby code using the current context # # @param node [Array] Node code generation data # @param indent [Fixnum] Size of the indentation to be added # def evaluate(node, indent) # Check if this is a substructure of a control block and remove the last # end evaluation if it is if node[@value] =~ Settings::END_REMOVAL @template.pop if @template[-1] == [:eval, 'end'] end # Check for explicit end node if node[@value] =~ Settings::END_EXPLICIT Logger.error :compile, @template, :explicit_end, node end # Evaluate the current expression buffer_eval node[@value] # If the node has children, evaluate each one of them if node[@children] node[@children].each do |child| root child, indent + @settings[:indent] end end # Check if the node is actually a block expression buffer_eval 'end' if node[@value] =~ Settings::END_INSERTION end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
opulent-1.6.0 | lib/opulent/compiler/eval.rb |