# Class: Haml::Compiler

Inherits:
  Object
  - Object
  - Haml::Compiler
  show all

Defined in:
  lib/haml/compiler.rb,
  lib/haml/compiler/tag_compiler.rb,
  lib/haml/compiler/script_compiler.rb,
  lib/haml/compiler/comment_compiler.rb,
  lib/haml/compiler/doctype_compiler.rb,
  lib/haml/compiler/children_compiler.rb,
  lib/haml/compiler/silent_script_compiler.rb

## Defined Under Namespace

Classes: ChildrenCompiler, CommentCompiler, DoctypeCompiler, ScriptCompiler, SilentScriptCompiler, TagCompiler

## Instance Method Summary collapse

- #call(ast)
- #initialize(options = {}) ⇒ Compiler constructor

  A new instance of Compiler.

## Constructor Details

### #initialize(options = {}) ⇒ `Compiler`

Returns a new instance of Compiler.

    13
    14
    15
    16
    17
    18
    19
    20
    21
    22

    # File 'lib/haml/compiler.rb', line 13

    def initialize(options = {})
      identity                = Identity.new
      @children_compiler      = ChildrenCompiler.new
      @comment_compiler       = CommentCompiler.new
      @doctype_compiler       = DoctypeCompiler.new(options)
      @filter_compiler        = Filters.new(options)
      @script_compiler        = ScriptCompiler.new(identity, options)
      @silent_script_compiler = SilentScriptCompiler.new
      @tag_compiler           = TagCompiler.new(identity, options)
    end

## Instance Method Details

### #call(ast)

    24
    25
    26
    27
    28
    29

    # File 'lib/haml/compiler.rb', line 24

    def call(ast)
      return runtime_error(ast) if ast.is_a?(Error)
      compile(ast)
    rescue Error => e
      runtime_error(e)
    end