Skip to content

Commit 2ba05c8

Browse files
fxnjosevalim
authored andcommitted
edits in the module attributes chapter (elixir-lang#904)
1 parent e596ded commit 2ba05c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

getting-started/module-attributes.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ defmodule Math do
5757
end
5858
```
5959

60-
Elixir promotes the use of markdown with heredocs to write readable documentation. Heredocs are multiline strings, they start and end with triple double-quotes, keeping the formatting of the inner text. We can access the documentation of any compiled module directly from IEx:
60+
Elixir promotes the use of Markdown with heredocs to write readable documentation. Heredocs are multiline strings, they start and end with triple double-quotes, keeping the formatting of the inner text. We can access the documentation of any compiled module directly from IEx:
6161

6262
```bash
6363
$ elixirc math.ex
@@ -141,7 +141,7 @@ IO.puts "Running MyPlug with Cowboy on http://localhost:4000"
141141
Plug.Adapters.Cowboy.http MyPlug, []
142142
```
143143

144-
In the example above, we have used the `plug/1` macro to connect functions that will be invoked when there is a web request. Internally, every time you call `plug/1`, the Plug library stores the given argument in a `@plugs` attribute. Just before the module is compiled, Plug runs a callback that defines a function (`call/2`) which handles http requests. This function will run all plugs inside `@plugs` in order.
144+
In the example above, we have used the `plug/1` macro to connect functions that will be invoked when there is a web request. Internally, every time you call `plug/1`, the Plug library stores the given argument in a `@plugs` attribute. Just before the module is compiled, Plug runs a callback that defines a function (`call/2`) which handles HTTP requests. This function will run all plugs inside `@plugs` in order.
145145

146146
In order to understand the underlying code, we'd need macros, so we will revisit this pattern in the meta-programming guide. However the focus here is on how using module attributes as storage allows developers to create DSLs.
147147

0 commit comments

Comments
 (0)