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 fa16ae0 commit 89151bdCopy full SHA for 89151bd
1 file changed
README.adoc
@@ -6304,6 +6304,33 @@ end
6304
6305
Avoid more than three levels of block nesting.
6306
6307
+[source,ruby]
6308
+----
6309
+# bad
6310
+def process(items)
6311
+ items.each do |item|
6312
+ item.widgets.each do |widget|
6313
+ widget.parts.each do |part|
6314
+ part.update!
6315
+ end
6316
6317
6318
+end
6319
+
6320
+# good
6321
6322
6323
+ process_widgets(item.widgets)
6324
6325
6326
6327
+def process_widgets(widgets)
6328
+ widgets.each do |widget|
6329
+ widget.parts.each(&:update!)
6330
6331
6332
6333
6334
=== Functional Code [[functional-code]]
6335
6336
Code in a functional way, avoiding mutation when that makes sense.
0 commit comments