summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobiasz Małecki <tobiasz.malecki@appunite.com>2019-01-27 18:07:43 +0100
committerJosé Valim <jose.valim@gmail.com>2019-01-27 18:07:43 +0100
commit89ae8631d4df98db10574f45523e404911314010 (patch)
tree271fb756eb4237f0aa90d4d7fcde4172c8c3bed6
parente883e32f41caaed2121074623040a247b09f9ddb (diff)
downloadelixir-89ae8631d4df98db10574f45523e404911314010.tar.gz
IEx.Helpers docs examples improvement (#8724)
-rw-r--r--lib/iex/lib/iex/helpers.ex17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/iex/lib/iex/helpers.ex b/lib/iex/lib/iex/helpers.ex
index 67c5e14b8..8a4070738 100644
--- a/lib/iex/lib/iex/helpers.ex
+++ b/lib/iex/lib/iex/helpers.ex
@@ -1049,8 +1049,8 @@ defmodule IEx.Helpers do
expanded:
# This raises a File.Error if ~/.iex.exs doesn't exist.
- if ("~/.iex.exs" |> Path.expand |> File.exists?) do
- import_file "~/.iex.exs"
+ if "~/.iex.exs" |> Path.expand() |> File.exists?() do
+ import_file("~/.iex.exs")
end
This macro addresses this issue by checking if the file exists or not
@@ -1092,7 +1092,7 @@ defmodule IEx.Helpers do
value = 13
# in the shell
- iex(1)> import_file "~/file.exs"
+ iex(1)> import_file("~/file.exs")
13
iex(2)> value
13
@@ -1122,7 +1122,7 @@ defmodule IEx.Helpers do
## Example
# In ~/.iex.exs
- import_if_available Ecto.Query
+ import_if_available(Ecto.Query)
"""
defmacro import_if_available(quoted_module, opts \\ []) do
@@ -1144,7 +1144,7 @@ defmodule IEx.Helpers do
## Example
# In ~/.iex.exs
- use_if_available Phoenix.HTML
+ use_if_available(Phoenix.HTML)
"""
@doc since: "1.7.0"
@@ -1295,8 +1295,11 @@ defmodule IEx.Helpers do
## Examples
iex> nl(HelloWorld)
- {:ok, [{:node1@easthost, :loaded, HelloWorld},
- {:node1@westhost, :loaded, HelloWorld}]}
+ {:ok,
+ [
+ {:node1@easthost, :loaded, HelloWorld},
+ {:node1@westhost, :loaded, HelloWorld}
+ ]}
iex> nl(NoSuchModuleExists)
{:error, :nofile}