Skip to content

Commit d264fa9

Browse files
committed
Rubocop: Fix presence cop violations
These are fine. (cherry picked from commit b773daa)
1 parent 6e6ca97 commit d264fa9

File tree

2 files changed

+2
-2
lines changed
  • core/app/models/spree
  • legacy_promotions/app/models/spree/promotion_handler

2 files changed

+2
-2
lines changed

core/app/models/spree/payment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def amount=(amount)
8383
when String
8484
separator = I18n.t('number.currency.format.separator')
8585
number = amount.delete("^0-9-#{separator}\.").tr(separator, '.')
86-
number.to_d if number.present?
86+
number.presence&.to_d
8787
end || amount
8888
end
8989

legacy_promotions/app/models/spree/promotion_handler/cart.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def sale_promotions
6161

6262
def promotion_code(promotion)
6363
order_promotion = order.order_promotions.detect { |op| op.promotion_id == promotion.id }
64-
order_promotion.present? ? order_promotion.promotion_code : nil
64+
order_promotion.presence&.promotion_code
6565
end
6666

6767
def promotion_includes

0 commit comments

Comments
 (0)