File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ call, depending on the context where it was used.
9
9
10
10
## Installation
11
11
12
- If [ available in Hex ] ( https://hex.pm/docs/publish ) , the package can be installed
13
- by adding ` ex_const ` to your list of dependencies in ` mix.exs ` :
12
+ The package can be installed by adding ` ex_const ` to your list of dependencies
13
+ in ` mix.exs ` :
14
14
15
15
``` elixir
16
16
def deps do
@@ -106,16 +106,18 @@ Or with the expanded syntax:
106
106
end
107
107
108
108
e.g.
109
-
110
- enum country_code, do: [argentina: "AR", italy: "IT", usa: "US"]
109
+ ``` elixir
110
+ enum country_code, do: [argentina: " AR" , italy: " IT" , usa: " US" ]
111
+ ```
111
112
112
113
Or:
113
-
114
- enum country_code do
115
- argentina "AR"
116
- italy "IT"
117
- usa "US"
118
- end
114
+ ``` elixir
115
+ enum country_code do
116
+ argentina " AR"
117
+ italy " IT"
118
+ usa " US"
119
+ end
120
+ ```
119
121
120
122
For each ` enum ` instance, the macro will create the following additional macros
121
123
and functions in the module where it was invoked:
@@ -131,10 +133,11 @@ and functions in the module where it was invoked:
131
133
` enum ` will be used and the other ones will be disregarded.
132
134
133
135
e.g.
134
-
135
- defmacro country_code(atom) :: String.t
136
- def country_code_enum(atom) :: String.t
137
- def from_country_code(String.t) :: atom
136
+ ``` elixir
137
+ defmacro country_code (atom) :: String .t
138
+ def country_code_enum (atom) :: String .t
139
+ def from_country_code (String .t ) :: atom
140
+ ```
138
141
139
142
The enumerated values can be accessed with a function call:
140
143
You can’t perform that action at this time.
0 commit comments