Module: Temple::Mixins::Template Private

Includes:
ClassOptions
Included in:
Templates::Rails, Templates::Tilt
Defined in:
lib/temple/mixins/template.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods included from ClassOptions

#default_options, #define_deprecated_options, #define_options, #disable_option_validator!, #options, #set_default_options, #set_options

Instance Method Details

#compile(code, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
# File 'lib/temple/mixins/template.rb', line 8

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

#create(engine, options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
24
25
26
# File 'lib/temple/mixins/template.rb', line 18

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

#register_as(*names) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/temple/mixins/template.rb', line 14

def register_as(*names)
  raise NotImplementedError
end