Skip to content

Commit 63b909d

Browse files
committed
Use pattern matching instead of an if-guard
1 parent 1be24fa commit 63b909d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ecommerce/processes/lib/processes/three_plus_one_free.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ def apply(event)
4545
end
4646

4747
def act
48-
return if state.free_product == state.eligible_free_product
49-
5048
case [state.free_product, state.eligible_free_product]
49+
in [the_same_product, ^the_same_product]
5150
in [nil, new_free_product]
5251
make_new_product_for_free(new_free_product)
5352
in [old_free_product, *]

0 commit comments

Comments
 (0)