Sha256: 9c740fdbb58dcdccb80b64230daad10864db48e6b67c4c42d1b0ddd6a4415b48

Contents?: true

Size: 727 Bytes

Versions: 10

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true
module Temple
  module Mixins
    # @api private
    module Template
      include ClassOptions

      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.options[:engine] = engine
        template.options.update(options)
        template.register_as(*register_as) if register_as
        template
      end
    end
  end
end

Version data entries

10 entries across 9 versions & 3 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
brakeman-7.0.0 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
brakeman-6.2.2 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
brakeman-6.2.2.rc1 bundle/ruby/3.3.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
brakeman-6.2.1 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
brakeman-6.2.0 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/mixins/template.rb
temple-0.10.3 lib/temple/mixins/template.rb
temple-0.10.2 lib/temple/mixins/template.rb
temple-0.10.1 lib/temple/mixins/template.rb