Sha256: 4841e2016ccad1999fbe8e6d3590e769a9df594211858d1a74e2a866092799ad

Contents?: true

Size: 477 Bytes

Versions: 12

Compression:

Stored size: 477 Bytes

Contents

module Hamlit
  class Compiler
    class SilentScriptCompiler
      def compile(node, &block)
        if node.children.empty?
          [:multi, [:code, node.value[:text]], [:newline]]
        else
          compile_with_children(node, &block)
        end
      end

      private

      def compile_with_children(node, &block)
        [:multi,
         [:block, node.value[:text],
          [:multi, [:newline], yield(node)],
         ],
        ]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hamlit-2.2.4 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.6.1 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.6.0 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.5.0 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.4.2 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.4.1 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.4.0 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.3.1 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.3.0 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.2.3 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.2.2 lib/hamlit/compiler/silent_script_compiler.rb
hamlit-2.2.1 lib/hamlit/compiler/silent_script_compiler.rb