Class: Slim::Engine

Inherits:
Object
  • Object
show all
Includes:
Compiler
Defined in:
lib/slim/engine.rb

Constant Summary

Constants included from Compiler

Compiler::AUTOCLOSED, Compiler::REGEX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Compiler

#compile

Methods included from Optimizer

#optimize

Constructor Details

#initialize(template) ⇒ Slim::Engine

Returns instance of engine.

Parameters:

  • template

    The .slim template to convert



10
11
12
13
# File 'lib/slim/engine.rb', line 10

def initialize(template)
  @template = template
  compile
end

Instance Attribute Details

#compiledObject (readonly)

Returns the value of attribute compiled.



5
6
7
# File 'lib/slim/engine.rb', line 5

def compiled
  @compiled
end

#optimizedObject (readonly)

Returns the value of attribute optimized.



6
7
8
# File 'lib/slim/engine.rb', line 6

def optimized
  @optimized
end

Instance Method Details

#render(scope = Object.new, locals = {}) ⇒ Object



15
16
17
# File 'lib/slim/engine.rb', line 15

def render(scope = Object.new, locals = {})
  scope.instance_eval(optimized)
end