Skip to content

Commit c696628

Browse files
committed
Prefer .zero? over == 0 to match code extracted into a concern
The code written in the "In Stock Email Notifications" section uses `.zero?` to check if the inventory was empty. In contrast the code snippet shown in the following section, "Extracting a Concern", changes the comparison to `== 0`. Consistency one way or the other would help reduce confusion.
1 parent 3b8d4da commit c696628

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

guides/source/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ module Product::Notifications
23152315
end
23162316

23172317
def back_in_stock?
2318-
inventory_count_previously_was == 0 && inventory_count > 0
2318+
inventory_count_previously_was.zero? && inventory_count > 0
23192319
end
23202320

23212321
def notify_subscribers

0 commit comments

Comments
 (0)