We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56cd5b6 commit aa4fc4eCopy full SHA for aa4fc4e
ch14-blocks-and-procs/better_program_logger.rb
@@ -1,3 +1,10 @@
1
+$nesting_depth = 0
2
+
3
def log desc, &block
- # 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}"
10
end
0 commit comments