Sha256: 821ac52cf42844e79ee9af7b3e1e7936c4f27ecbdec74fdf004f2df47e9f2d25

Contents?: true

Size: 715 Bytes

Versions: 11

Compression:

Stored size: 715 Bytes

Contents

module Temple
  module Mixins
    # @api private
    module Template
      include DefaultOptions

      def compile(code, options)
        engine = options.delete(:engine)
        raise 'No engine configured' unless engine
        engine.new(options).call(code)
      end

      def register_as(*names)
        raise NotImplementedError
      end

      def create(engine, options)
        register_as = options.delete(:register_as)
        template = Class.new(self)
        template.disable_option_validator!
        template.default_options[:engine] = engine
        template.default_options.update(options)
        template.register_as(*register_as) if register_as
        template
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
temple-0.6.10 lib/temple/mixins/template.rb
temple-0.6.9 lib/temple/mixins/template.rb
temple-0.6.8 lib/temple/mixins/template.rb
temple-0.6.7 lib/temple/mixins/template.rb
temple-0.6.6 lib/temple/mixins/template.rb
temple-0.6.5 lib/temple/mixins/template.rb
temple-0.6.4 lib/temple/mixins/template.rb
temple-0.6.3 lib/temple/mixins/template.rb
temple-0.6.0 lib/temple/mixins/template.rb
temple-0.5.5 lib/temple/mixins/template.rb
temple-0.5.4 lib/temple/mixins/template.rb