Sha256: 228f0b352937eaa7e7d6295eca26ee9b8c43821ba806c2b3941c9357aff272ed

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

require 'sanford/template_engine'

module Sanford

  class TemplateSource

    attr_reader :path, :engines

    def initialize(path)
      @path = path.to_s
      @default_opts = { 'source_path' => @path }
      @engines = Hash.new{ |h,k| Sanford::NullTemplateEngine.new(@default_opts) }
    end

    def engine(input_ext, engine_class, registered_opts = nil)
      engine_opts = @default_opts.merge(registered_opts || {})
      @engines[input_ext.to_s] = engine_class.new(engine_opts)
    end

  end

  class NullTemplateSource < TemplateSource

    def initialize
      super('')
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sanford-0.10.0 lib/sanford/template_source.rb