Sha256: 986eb4815c110b319d29767b5c98faa781c1d71c0a63611101542e7e7684a455

Contents?: true

Size: 720 Bytes

Versions: 7

Compression:

Stored size: 720 Bytes

Contents

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

module Faml
  class Engine < Temple::Engine
    define_options(
      generator: Temple::Generators::ArrayBuffer,
      filename: nil,
    )

    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

7 entries across 7 versions & 1 rubygems

Version Path
faml-0.2.12 lib/faml/engine.rb
faml-0.2.11 lib/faml/engine.rb
faml-0.2.10 lib/faml/engine.rb
faml-0.2.9 lib/faml/engine.rb
faml-0.2.8 lib/faml/engine.rb
faml-0.2.7 lib/faml/engine.rb
faml-0.2.6 lib/faml/engine.rb