File tree Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -1890,19 +1890,19 @@ defmodule Kernel do
1890
1890
1891
1891
## Options
1892
1892
1893
- The following options are supported:
1894
-
1895
- * :raw - tuples are not formatted as the inspect protocol, they are
1896
- always shown as tuples, defaults to false;
1897
-
1898
- * :limit - the limit of items that are shown in tuples, bitstrings and
1899
- lists. Does not apply to strings;
1893
+ See the docs for IEx.Options for more details.
1900
1894
1901
1895
## Examples
1902
1896
1903
1897
iex> inspect(:foo)
1904
1898
":foo"
1905
1899
1900
+ inspect(ArgumentError[])
1901
+ #=> "ArgumentError[message: \" argument error\" ]"
1902
+
1903
+ inspect(ArgumentError[], raw: true)
1904
+ #=> "{ArgumentError,:__exception__,\" argument error\" }"
1905
+
1906
1906
Note that the inspect protocol does not necessarily return a valid
1907
1907
representation of an Elixir term. In such cases, the inspected result must
1908
1908
start with `#`. For example, inspecting a function will return:
Original file line number Diff line number Diff line change @@ -24,7 +24,20 @@ defmodule IEx.Options do
24
24
"""
25
25
] ,
26
26
inspect: [
27
- doc: ""
27
+ doc: """
28
+ Control the behavior of the shell's inspecting algorithm. Inspect is
29
+ used for printing results of evaluating expressions. It is also used by IO.inspect.
30
+
31
+ The value is a keyword list that should have any of the following keys
32
+ specified. If any of the keys is omitted, that option is not changed.
33
+
34
+ * raw -- when true, record tuples are not formatted by the inspect protocol,
35
+ but are printed as just tuples; default: false
36
+
37
+ * limit -- limits the number of items that are printed for tuples, bitstrings,
38
+ and lists; does not apply to strings
39
+
40
+ """
28
41
] ,
29
42
]
30
43
@@ -69,6 +82,7 @@ defmodule IEx.Options do
69
82
70
83
def set ( :inspect , opts ) when is_list ( opts ) do
71
84
old_opts = IEx . inspect_opts
85
+ # FIXME: validate keys before setting
72
86
IEx . inspect_opts ( opts )
73
87
old_opts
74
88
end
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ defmodule IEx.Mixfile do
8
8
def application do
9
9
[ env: [
10
10
after_spawn: [ ] ,
11
- inspect_opts: [ limit: 50 ] ,
11
+ inspect_opts: [ limit: 50 , raw: false ] ,
12
12
colors: [
13
13
enabled: true ,
14
14
eval_result: "yellow" ,
You can’t perform that action at this time.
0 commit comments