Sha256: eb904988d3fa43f7f0c9d1b00d3414b838a2f8652fcd2ba7b4218069b09b00ee

Contents?: true

Size: 723 Bytes

Versions: 3

Compression:

Stored size: 723 Bytes

Contents

require 'temple'
require 'fast_haml/compiler'
require 'fast_haml/html'
require 'fast_haml/newline'
require 'fast_haml/parser'

module FastHaml
  class Engine < Temple::Engine
    define_options(
      generator: Temple::Generators::ArrayBuffer,
    )

    DEFAULT_OPTIONS = {
        format: :html,
        attr_quote: "'",
    }.freeze

    def initialize(opts = {})
      super(DEFAULT_OPTIONS.merge(opts))
    end

    use Parser
    use Compiler
    use Html
    filter :Escapable
    filter :ControlFlow
    filter :MultiFlattener
    use Newline
    filter :StaticMerger
    use :Generator do
      options[:generator].new(options.to_hash.reject {|k,v| !options[:generator].options.valid_key?(k) })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fast_haml-0.1.10 lib/fast_haml/engine.rb
fast_haml-0.1.9 lib/fast_haml/engine.rb
fast_haml-0.1.8 lib/fast_haml/engine.rb