@@ -15,7 +15,7 @@ defmodule Code do
15
15
"""
16
16
17
17
@ doc """
18
- Returns all the loaded files.
18
+ Returns all loaded files.
19
19
"""
20
20
def loaded_files do
21
21
:elixir_code_server . call :loaded
@@ -32,24 +32,24 @@ defmodule Code do
32
32
end
33
33
34
34
@ doc """
35
- Appends a path to Erlang VM code path.
36
- The path is expanded with `Path.expand` before being appended.
35
+ Appends a path to the Erlang VM code path.
36
+ The path is expanded with `Path.expand/1 ` before being appended.
37
37
"""
38
38
def append_path ( path ) do
39
39
:code . add_pathz ( Path . expand to_char_list ( path ) )
40
40
end
41
41
42
42
@ doc """
43
- Prepends a path to Erlang VM code path.
44
- The path is expanded with `Path.expand` before being prepended.
43
+ Prepends a path to the Erlang VM code path.
44
+ The path is expanded with `Path.expand/1 ` before being prepended.
45
45
"""
46
46
def prepend_path ( path ) do
47
47
:code . add_patha ( Path . expand to_char_list ( path ) )
48
48
end
49
49
50
50
@ doc """
51
- Deletes a path from Erlang VM code path.
52
- The path is expanded with `Path.expand` before being deleted.
51
+ Deletes a path from the Erlang VM code path.
52
+ The path is expanded with `Path.expand/1 ` before being deleted.
53
53
"""
54
54
def delete_path ( path ) do
55
55
:code . del_path ( Path . expand to_char_list ( path ) )
@@ -203,17 +203,17 @@ defmodule Code do
203
203
## Options
204
204
205
205
* `:file` - The filename to be used in stacktraces
206
- and the file reported in the __ENV__ variable.
206
+ and the file reported in the ` __ENV__` variable.
207
207
208
- * `:line` - The line reported in the __ENV__ variable.
208
+ * `:line` - The line reported in the ` __ENV__` variable.
209
209
210
- * `:existing_atoms_only` - When true, raises an error
210
+ * `:existing_atoms_only` - When ` true` , raises an error
211
211
when non-existing atoms are found by the tokenizer.
212
212
213
213
## Macro.to_string/1
214
214
215
215
The opposite of converting a string to its quoted form is
216
- `Macro.to_string`, which converts a quoted form to a string/binary
216
+ `Macro.to_string/1 `, which converts a quoted form to a string/binary
217
217
representation.
218
218
"""
219
219
def string_to_quoted ( string , opts // [ ] ) do
@@ -229,11 +229,11 @@ defmodule Code do
229
229
230
230
@ doc """
231
231
Converts the given string to its quoted form. It returns the ast if it succeeds,
232
- raises an exception otherwise. The exception is a TokenMissingError
232
+ raises an exception otherwise. The exception is a ` TokenMissingError`
233
233
in case a token is missing (usually because the expression is incomplete),
234
- SyntaxError otherwise.
234
+ ` SyntaxError` otherwise.
235
235
236
- Check `Code. string_to_quoted/2` for options information.
236
+ Check `string_to_quoted/2` for options information.
237
237
"""
238
238
def string_to_quoted! ( string , opts // [ ] ) do
239
239
file = Keyword . get opts , :file , "nofile"
@@ -249,14 +249,14 @@ defmodule Code do
249
249
@ doc """
250
250
Loads the given `file`. Accepts `relative_to` as an argument to tell where
251
251
the file is located. If the file was already required/loaded, loads it again.
252
- It returns a list of tuples { ModuleName, <<byte_code>> }, one tuple for each
252
+ It returns a list of tuples ` { ModuleName, <<byte_code>> }` , one tuple for each
253
253
module defined in the file.
254
254
255
255
Notice that if `load_file` is invoked by different processes
256
256
concurrently, the target file will be invoked concurrently
257
257
many times. I.e. if `load_file` is called N times with
258
258
a given file, the given file will be loaded N times. Check
259
- `require_file` if you don't want a file to be loaded concurrently.
259
+ `require_file/2 ` if you don't want a file to be loaded concurrently.
260
260
"""
261
261
def load_file ( file , relative_to // nil ) when is_binary ( file ) do
262
262
file = find_file ( file , relative_to )
@@ -268,16 +268,16 @@ defmodule Code do
268
268
269
269
@ doc """
270
270
Requires the given `file`. Accepts `relative_to` as an argument to tell where
271
- the file is located. The return value is the same as that of `load_file`. If
271
+ the file is located. The return value is the same as that of `load_file/2 `. If
272
272
the file was already required/loaded, doesn't do anything and returns nil.
273
273
274
274
Notice that if `require_file` is invoked by different processes concurrently,
275
275
the first process to invoke `require_file` acquires a lock and the remaining
276
276
ones will block until the file is available. I.e. if `require_file` is called
277
277
N times with a given file, it will be loaded only once. The first process to
278
- call `require_file` will get the list of loaded modules, others will get nil.
278
+ call `require_file` will get the list of loaded modules, others will get ` nil` .
279
279
280
- Check `load_file` if you want a file to be loaded concurrently.
280
+ Check `load_file/2 ` if you want a file to be loaded concurrently.
281
281
"""
282
282
def require_file ( file , relative_to // nil ) when is_binary ( file ) do
283
283
file = find_file ( file , relative_to )
@@ -308,17 +308,17 @@ defmodule Code do
308
308
309
309
Available options are:
310
310
311
- * `:docs` - when true, retain documentation in the compiled module,
312
- true by default;
311
+ * `:docs` - when ` true` , retain documentation in the compiled module,
312
+ ` true` by default;
313
313
314
- * `:debug_info` - when true, retain debug information in the compiled module.
314
+ * `:debug_info` - when ` true` , retain debug information in the compiled module.
315
315
This allows a developer to reconstruct the original source
316
- code, for such reasons, false by default;
316
+ code, for such reasons, ` false` by default;
317
317
318
- * `:ignore_module_conflict` - when true, override modules that were already defined
319
- without raising errors, false by default;
318
+ * `:ignore_module_conflict` - when ` true` , override modules that were already defined
319
+ without raising errors, ` false` by default;
320
320
321
- * `:warnings_as_errors` - cause compilation to fail when warnings are spewed ;
321
+ * `:warnings_as_errors` - cause compilation to fail when warnings are generated ;
322
322
323
323
"""
324
324
def compiler_options ( opts ) do
@@ -347,7 +347,7 @@ defmodule Code do
347
347
348
348
@ doc """
349
349
Ensures the given module is loaded. If the module is already
350
- loaded, it works as no-op. If the module was not loaded yet,
350
+ loaded, it works as no-op. If the module was not yet loaded ,
351
351
it tries to load it.
352
352
353
353
If it succeeds loading the module, it returns
@@ -362,9 +362,9 @@ defmodule Code do
362
362
are loaded as needed. In embedded mode the opposite happens, as all
363
363
modules need to be loaded upfront or explicitly.
364
364
365
- Therefore, this function is useful to check if a module is loaded
366
- before using it and react accordingly. For example, the `URI` module
367
- uses this function to check if a specific parser exists for a given
365
+ Therefore, this function is used to check if a module is loaded
366
+ before using it and allows one to react accordingly. For example, the `URI`
367
+ module uses this function to check if a specific parser exists for a given
368
368
URI scheme.
369
369
370
370
## Code.ensure_compiled
@@ -373,15 +373,15 @@ defmodule Code do
373
373
superset of `ensure_loaded/1`.
374
374
375
375
Since Elixir's compilation happens in parallel, in some situations
376
- you may need to use a module but it was not compiled yet, therefore
376
+ you may need to use a module but that was not yet compiled , therefore
377
377
it can't even be loaded.
378
378
379
- `ensure_compiled/1` puts a halt in the current process until the
379
+ `ensure_compiled/1` halts the current process until the
380
380
module we are depending on is available.
381
381
382
- In most of the cases, `ensure_loaded` is enough. `ensure_compiled`
383
- must be used just in same rare conditions , usually involving macros
384
- that needs to invoke a module for callback information.
382
+ In most cases, `ensure_loaded` is enough. `ensure_compiled`
383
+ must be used in some rare cases , usually involving macros
384
+ that need to invoke a module for callback information.
385
385
"""
386
386
def ensure_loaded ( module ) when is_atom ( module ) do
387
387
:code . ensure_loaded ( module )
@@ -398,7 +398,7 @@ defmodule Code do
398
398
@ doc """
399
399
Ensures the given module is compiled and loaded. If the module
400
400
is already loaded, it works as no-op. If the module was not
401
- loaded yet, it checks if it needs to be compiled first and just
401
+ loaded yet, it checks if it needs to be compiled first and
402
402
then tries to load it.
403
403
404
404
If it succeeds loading the module, it returns
0 commit comments