Sha256: bf978e7b1b7f8fa04230a61448d795d14868d42ec9d73e36267aa90f8dc4bd8a

Contents?: true

Size: 681 Bytes

Versions: 5

Compression:

Stored size: 681 Bytes

Contents

require 'temple'
require 'hamlit/compiler'
require 'hamlit/html'
require 'hamlit/parser'
require 'hamlit/temple'

module Hamlit
  class Engine < Temple::Engine
    define_options(
      generator:   Temple::Generators::ArrayBuffer,
      format:      :html,
      attr_quote:  "'",
    )

    use Parser
    use Compiler
    use HTML
    filter :Escapable
    filter :ControlFlow
    filter :MultiFlattener
    filter :StaticMerger
    use :Generator, -> { create(options[:generator]) }

    private

    def create(klass)
      valid_options = options.to_hash.select do |key, value|
        klass.options.valid_key?(key)
      end
      klass.new(valid_options)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hamlit-1.2.1 lib/hamlit/engine.rb
hamlit-1.2.0 lib/hamlit/engine.rb
hamlit-1.1.1 lib/hamlit/engine.rb
hamlit-1.1.0 lib/hamlit/engine.rb
hamlit-1.0.0 lib/hamlit/engine.rb