Skip to content

Commit ac666a9

Browse files
author
José Valim
committed
Improve docs for EEx.AssignsEngine, closes #1499
1 parent cca4ac9 commit ac666a9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/eex/lib/eex/smart_engine.ex

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ defmodule EEx.AssignsEngine do
6767
a template, after compiled, may receive different assigns
6868
and the developer don't want to recompile it for each
6969
variable set.
70+
71+
Assigns can also be used when compiled to a function:
72+
73+
# sample.eex
74+
<%= @a + @b %>
75+
76+
# sample.ex
77+
defmodule Sample do
78+
require EEx
79+
EEx.function_from_file :def, :sample, "sample.eex", [:assigns]
80+
end
81+
82+
# iex
83+
Sample.sample(a: 1, b: 2) #=> "3"
84+
7085
"""
7186

7287
@doc false
@@ -91,7 +106,7 @@ defmodule EEx.SmartEngine do
91106

92107
@moduledoc """
93108
An engine meant for end-user usage that includes
94-
`AssignsEngine` and other conveniences. Read
109+
`EEx.AssignsEngine` and other conveniences. Read
95110
`EEx.AssignsEngine` for examples.
96111
"""
97112
end

0 commit comments

Comments
 (0)