We had a few lines that were simply too long, so I broke them up.
Two of them I did by factoring out a parameter into a variable, which
felt a little weird, but I liked the overall flow of the line otherwise
and I didn't want to have the whole block need to change just because
the pattern was a few characters too long...
I think it's clear enough.
@@ -141,8 +141,8 @@ class InteracEmail
end
def dkim_headers
- # Apparently there can sometimes be multiple DKIM sigs- # And this library returns a scalar if there's one, or array otherwise
+ # Apparently there can sometimes be multiple DKIM sigs, and this
+ # library returns a scalar if there's one, or array otherwise.
# This Array method, when passed `nil` even returns an emtpy list!
Array(@m["DKIM-Signature"]).map { |s|
s.value
@@ -159,7 +159,8 @@ class InteracEmail
raise Error::NoDKIM, @m if dkim.empty?
- raise Error::WrongDKIM, @m unless dkim.any? {|v| v[:d] == "payments.interac.ca" }
+ d = "payments.interac.ca"
+ raise Error::WrongDKIM, @m unless dkim.any? { |v| v[:d] == d }
end
end
@@ -34,7 +34,8 @@ class RedisAddresses
# Basically it's "how long does each command take"
# The lower it is (default is 10), it will go back and forth
# to the client a ton
- @redis.scan_each(match: "jmp_customer_#{@currency}_addresses-*", count: 1000) do |key|
+ pattern = "jmp_customer_#{@currency}_addresses-*"
+ @redis.scan_each(match: pattern, count: 1000) do |key|
@redis.smembers(key).each do |addr|
addrs[addr] << key
end