# EEx v1.10.3 EEx.SmartEngine View Source

The default engine used by EEx.

It includes assigns (like `@foo`) and possibly other conveniences in the future.

## Examples

    iex> EEx.eval_string("<%= @foo %>", assigns: [foo: 1])
    "1"

In the example above, we can access the value `foo` under the binding `assigns` using `@foo`. This is useful because a template, after being compiled, can receive different assigns and would not require recompilation for each variable set.

Assigns can also be used when compiled to a function:

    # sample.eex
    <%= @a + @b %>

    # sample.ex
    defmodule Sample do
      require EEx
      EEx.function_from_file(:def, :sample, "sample.eex", [:assigns])
    end

    # iex
    Sample.sample(a: 1, b: 2)
    #=> "3"

# Link to this section Summary

## Functions

handle_begin(state)

Callback implementation for `c:EEx.Engine.handle_begin/1`.

handle_body(state)

Callback implementation for `c:EEx.Engine.handle_body/1`.

handle_end(state)

Callback implementation for `c:EEx.Engine.handle_end/1`.

handle_expr(state, marker, expr)

Callback implementation for `c:EEx.Engine.handle_expr/3`.

handle_text(state, text)

Callback implementation for `c:EEx.Engine.handle_text/2`.

init(opts)

Callback implementation for `c:EEx.Engine.init/1`.

# Link to this section Functions

Link to this function

# handle_begin(state)

View Source

Callback implementation for `c:EEx.Engine.handle_begin/1`.

Link to this function

# handle_body(state)

View Source

Callback implementation for `c:EEx.Engine.handle_body/1`.

Link to this function

# handle_end(state)

View Source

Callback implementation for `c:EEx.Engine.handle_end/1`.

Link to this function

# handle_expr(state, marker, expr)

View Source

Callback implementation for `c:EEx.Engine.handle_expr/3`.

Link to this function

# handle_text(state, text)

View Source

Callback implementation for `c:EEx.Engine.handle_text/2`.

Link to this function

# init(opts)

View Source

Callback implementation for `c:EEx.Engine.init/1`.