Skip to content

Commit aa4fc4e

Browse files
committed
Chapter 14. Better program loggerrr
1 parent 56cd5b6 commit aa4fc4e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
$nesting_depth = 0
2+
13
def log desc, &block
2-
# your code here
4+
puts " " * $nesting_depth + "Beginning \"#{desc}\"..."
5+
$nesting_depth += 1
6+
result = block.call
7+
$nesting_depth -= 1
8+
puts " " * $nesting_depth + "...\"#{desc}\" finished, returning:"
9+
puts " " * $nesting_depth + "#{result}"
310
end

0 commit comments

Comments
 (0)