@@ -44,10 +44,15 @@ defmodule IEx.Helpers do
44
44
to write their object code to. It returns the name
45
45
of the compiled modules.
46
46
47
+ When compiling one file, there is no need to wrap it in a list.
48
+
47
49
## Examples
48
50
49
- c ["foo.ex"], "ebin"
50
- #=> [Foo]
51
+ c ["foo.ex", "bar.ex"], "ebin"
52
+ #=> [Foo,Bar]
53
+
54
+ c "baz.ex"
55
+ #=> [Baz]
51
56
52
57
"""
53
58
def c ( files , path // "." ) do
@@ -56,7 +61,8 @@ defmodule IEx.Helpers do
56
61
end
57
62
58
63
@ doc """
59
- Returns the name and module of all modules loaded.
64
+ Prints the list of all loaded modules with paths to their corresponding .beam
65
+ files.
60
66
"""
61
67
def m do
62
68
all = Enum . map :code . all_loaded , fn { mod , file } -> { inspect ( mod ) , file } end
@@ -70,7 +76,8 @@ defmodule IEx.Helpers do
70
76
end
71
77
72
78
@ doc """
73
- Prints commands history and their result.
79
+ Prints the history of expressions evaluated during the session along with
80
+ their results.
74
81
"""
75
82
def v do
76
83
history = Enum . reverse ( Process . get ( :iex_history ) )
@@ -82,14 +89,14 @@ defmodule IEx.Helpers do
82
89
end
83
90
84
91
@ doc """
85
- Shows the documentation for IEx.Helpers.
92
+ Prints the documentation for IEx.Helpers.
86
93
"""
87
94
def h ( ) do
88
95
IEx.Introspection . h ( IEx.Helpers )
89
96
end
90
97
91
98
@ doc """
92
- Shows the documentation for the given module
99
+ Prints the documentation for the given module
93
100
or for the given function/arity pair.
94
101
95
102
## Examples
@@ -136,8 +143,10 @@ defmodule IEx.Helpers do
136
143
end
137
144
138
145
@ doc """
139
- Prints all types for the given module or prints out a specified type's
140
- specification
146
+ When given a module, prints specifications (or simply specs) for all the
147
+ types defined in it.
148
+
149
+ When given a particular type name, prints its spec.
141
150
142
151
## Examples
143
152
@@ -165,7 +174,11 @@ defmodule IEx.Helpers do
165
174
end
166
175
167
176
@ doc """
168
- Prints all specs from a given module.
177
+ Similar to `t/1`, only for specs.
178
+
179
+ When given a module, prints the list of all specs defined in the module.
180
+
181
+ When given a particular spec name (with optional arity), prints its spec.
169
182
170
183
## Examples
171
184
@@ -207,9 +220,10 @@ defmodule IEx.Helpers do
207
220
end
208
221
209
222
@ doc """
210
- Retrieves nth query's value from the history. Use negative
211
- values to lookup query's value from latest to earliest.
212
- For instance, v(-1) returns the latest result.
223
+ Retrieves nth expression's value from the history.
224
+
225
+ Use negative values to lookup expression values relative to the current one.
226
+ For instance, v(-1) returns the result of the last evaluated expression.
213
227
"""
214
228
def v ( n ) when n < 0 do
215
229
history = Process . get ( :iex_history )
@@ -222,8 +236,8 @@ defmodule IEx.Helpers do
222
236
end
223
237
224
238
@ doc """
225
- Reloads all modules that were already reloaded
226
- at some point with `r/1` .
239
+ Reloads all modules that have already been reloaded with `r/1` at any point
240
+ in the current IEx session .
227
241
"""
228
242
def r do
229
243
Enum . map iex_reloaded , r ( & 1 )
@@ -232,8 +246,8 @@ defmodule IEx.Helpers do
232
246
@ doc """
233
247
Recompiles and reloads the specified module's source file.
234
248
235
- Please note that all the modules defined in the specified
236
- files are recompiled and reloaded.
249
+ Please note that all the modules defined in the same file as `module`
250
+ are recompiled and reloaded.
237
251
"""
238
252
def r ( module ) do
239
253
if source = source ( module ) do
@@ -245,15 +259,15 @@ defmodule IEx.Helpers do
245
259
end
246
260
247
261
@ doc """
248
- Purges and reloads specified module
262
+ Purges and reloads specified module.
249
263
"""
250
264
def l ( module ) do
251
265
:code . purge ( module )
252
266
:code . load_file ( module )
253
267
end
254
268
255
269
@ doc """
256
- Flushes all messages sent to the shell and prints them out
270
+ Flushes all messages sent to the shell and prints them out.
257
271
"""
258
272
def flush do
259
273
receive do
@@ -297,7 +311,7 @@ defmodule IEx.Helpers do
297
311
end
298
312
299
313
@ doc """
300
- Changes the shell directory to the given path.
314
+ Changes the current working directory to the given path.
301
315
"""
302
316
def cd ( directory ) do
303
317
case File . cd ( expand_home ( directory ) ) do
0 commit comments