Class: PrecompiledHaml::Engine

Inherits:
Haml::Engine
  • Object
show all
Defined in:
lib/precompiled_haml/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(template, options = {}) ⇒ Engine

This is identical to Haml::Engine#initialize, cause I don’t undestand how to call super method in inhereted class context (to use PrecompiledHaml::Options instead of Haml::Options) gist.github.com/Mik-die/5321100



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/precompiled_haml/engine.rb', line 11

def initialize(template, options = {})
  @options = Options.new(options)

  @template = check_haml_encoding(template) do |msg, line|
    raise Haml::Error.new(msg, line)
  end

  initialize_encoding options[:encoding]

  @parser   = @options.parser_class.new(@template, @options)
  @compiler = @options.compiler_class.new(@options)

  @compiler.compile(@parser.parse)
end