Skip to content

Commit 835403a

Browse files
committed
Fixed additional doc typos in Code module
1 parent 9200327 commit 835403a

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

lib/elixir/lib/code.ex

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Code do
1515
"""
1616

1717
@doc """
18-
Returns all the loaded files.
18+
Returns all loaded files.
1919
"""
2020
def loaded_files do
2121
:elixir_code_server.call :loaded
@@ -32,24 +32,24 @@ defmodule Code do
3232
end
3333

3434
@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.
3737
"""
3838
def append_path(path) do
3939
:code.add_pathz(Path.expand to_char_list(path))
4040
end
4141

4242
@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.
4545
"""
4646
def prepend_path(path) do
4747
:code.add_patha(Path.expand to_char_list(path))
4848
end
4949

5050
@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.
5353
"""
5454
def delete_path(path) do
5555
:code.del_path(Path.expand to_char_list(path))
@@ -203,17 +203,17 @@ defmodule Code do
203203
## Options
204204
205205
* `: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.
207207
208-
* `:line` - The line reported in the __ENV__ variable.
208+
* `:line` - The line reported in the `__ENV__` variable.
209209
210-
* `:existing_atoms_only` - When true, raises an error
210+
* `:existing_atoms_only` - When `true`, raises an error
211211
when non-existing atoms are found by the tokenizer.
212212
213213
## Macro.to_string/1
214214
215215
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
217217
representation.
218218
"""
219219
def string_to_quoted(string, opts // []) do
@@ -229,11 +229,11 @@ defmodule Code do
229229

230230
@doc """
231231
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`
233233
in case a token is missing (usually because the expression is incomplete),
234-
SyntaxError otherwise.
234+
`SyntaxError` otherwise.
235235
236-
Check `Code.string_to_quoted/2` for options information.
236+
Check `string_to_quoted/2` for options information.
237237
"""
238238
def string_to_quoted!(string, opts // []) do
239239
file = Keyword.get opts, :file, "nofile"
@@ -249,14 +249,14 @@ defmodule Code do
249249
@doc """
250250
Loads the given `file`. Accepts `relative_to` as an argument to tell where
251251
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
253253
module defined in the file.
254254
255255
Notice that if `load_file` is invoked by different processes
256256
concurrently, the target file will be invoked concurrently
257257
many times. I.e. if `load_file` is called N times with
258258
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.
260260
"""
261261
def load_file(file, relative_to // nil) when is_binary(file) do
262262
file = find_file(file, relative_to)
@@ -268,16 +268,16 @@ defmodule Code do
268268

269269
@doc """
270270
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
272272
the file was already required/loaded, doesn't do anything and returns nil.
273273
274274
Notice that if `require_file` is invoked by different processes concurrently,
275275
the first process to invoke `require_file` acquires a lock and the remaining
276276
ones will block until the file is available. I.e. if `require_file` is called
277277
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`.
279279
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.
281281
"""
282282
def require_file(file, relative_to // nil) when is_binary(file) do
283283
file = find_file(file, relative_to)
@@ -308,17 +308,17 @@ defmodule Code do
308308
309309
Available options are:
310310
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;
313313
314-
* `:debug_info` - when true, retain debug information in the compiled module.
314+
* `:debug_info` - when `true`, retain debug information in the compiled module.
315315
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;
317317
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;
320320
321-
* `:warnings_as_errors` - cause compilation to fail when warnings are spewed;
321+
* `:warnings_as_errors` - cause compilation to fail when warnings are generated;
322322
323323
"""
324324
def compiler_options(opts) do
@@ -347,7 +347,7 @@ defmodule Code do
347347

348348
@doc """
349349
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,
351351
it tries to load it.
352352
353353
If it succeeds loading the module, it returns
@@ -362,9 +362,9 @@ defmodule Code do
362362
are loaded as needed. In embedded mode the opposite happens, as all
363363
modules need to be loaded upfront or explicitly.
364364
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
368368
URI scheme.
369369
370370
## Code.ensure_compiled
@@ -373,15 +373,15 @@ defmodule Code do
373373
superset of `ensure_loaded/1`.
374374
375375
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
377377
it can't even be loaded.
378378
379-
`ensure_compiled/1` puts a halt in the current process until the
379+
`ensure_compiled/1` halts the current process until the
380380
module we are depending on is available.
381381
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.
385385
"""
386386
def ensure_loaded(module) when is_atom(module) do
387387
:code.ensure_loaded(module)
@@ -398,7 +398,7 @@ defmodule Code do
398398
@doc """
399399
Ensures the given module is compiled and loaded. If the module
400400
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
402402
then tries to load it.
403403
404404
If it succeeds loading the module, it returns

0 commit comments

Comments
 (0)