Skip to content

Commit d7c2f28

Browse files
author
Ary Borenszweig
committedJan 5, 2017
Let p and pp return the argument
1 parent ba5c2b0 commit d7c2f28

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed
 

Diff for: ‎src/kernel.cr

+9-7
Original file line numberDiff line numberDiff line change
@@ -83,33 +83,35 @@ def puts(*objects) : Nil
8383
end
8484

8585
# Pretty prints *object* to STDOUT followed
86-
# by a newline.
86+
# by a newline. Returns *object*.
8787
#
8888
# See also: `Object#pretty_print(pp)`.
89-
def p(object) : Nil
89+
def p(object)
9090
PrettyPrint.format(object, STDOUT, 79)
9191
puts
92+
object
9293
end
9394

9495
# Pretty prints each object in *objects* to STDOUT, followed
95-
# by a newline.
96+
# by a newline. Returns *objects*.
9697
#
9798
# See also: `Object#pretty_print(pp)`.
98-
def p(*objects) : Nil
99+
def p(*objects)
99100
objects.each do |obj|
100101
p obj
101102
end
103+
objects
102104
end
103105

104106
# Pretty prints each object in *objects* to STDOUT, followed
105-
# by a newline.
107+
# by a newline. Returns *objects*.
106108
#
107109
# ```
108-
# p foo: 23, bar: 42 # prints "{foo: 23, bar: 42}"
110+
# p foo: 23, bar: 42 # => {foo: 23, bar: 42}
109111
# ```
110112
#
111113
# See `Object#pretty_print(pp)`
112-
def p(**objects) : Nil
114+
def p(**objects)
113115
p(objects)
114116
end
115117

0 commit comments

Comments
 (0)
Please sign in to comment.