Skip to content

Commit aa6ae4b

Browse files
committed
method -> function
1 parent 2209c12 commit aa6ae4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

getting-started/module-attributes.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ IO.puts "Running MyPlug with Cowboy on http://localhost:4000"
148148
Plug.Adapters.Cowboy.http MyPlug, []
149149
```
150150

151-
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 method (`call/2`) which handles http requests. This method will run all plugs inside `@plugs` in order.
151+
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.
152152

153153
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 exactly on how using module attributes as storage allow developers to create DSLs.
154154

0 commit comments

Comments
 (0)