Rubocop autocorrections (indentations, revers unless to if, extra spaces)

This commit is contained in:
Bertocq
2017-06-07 01:11:36 +02:00
parent c45c374256
commit 02524b164a
21 changed files with 65 additions and 65 deletions

View File

@@ -26,18 +26,18 @@ module DocumentParser
else
letter = nil
end
return document_number, letter
[document_number, letter]
end
# if the number has less digits than it should, pad with zeros to the left and add each variant to the list
# For example, if the initial document_number is 1234, and digits=8, the result is
# ['1234', '01234', '001234', '0001234']
def get_number_variants_with_leading_zeroes_from(document_number, digits=8)
def get_number_variants_with_leading_zeroes_from(document_number, digits = 8)
document_number = document_number.to_s.last(digits) # Keep only the last x digits
document_number = document_number.gsub(/^0+/, '') # Removes leading zeros
variants = []
variants << document_number unless document_number.blank?
variants << document_number if document_number.present?
while document_number.size < digits
document_number = "0#{document_number}"
variants << document_number
@@ -50,7 +50,7 @@ module DocumentParser
# ['1234a', '1234A', '01234a', '01234A']
def get_letter_variants(number_variants, letter)
variants = []
if letter.present? then
if letter.present?
number_variants.each do |number|
variants << number + letter.downcase << number + letter.upcase
end