Skip to content

Commit

Permalink
Simplify slice! call on validate_nif method
Browse files Browse the repository at this point in the history
  • Loading branch information
007lva committed Feb 22, 2017
1 parent 01e2cc2 commit 2e61926
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/spanish_vat_validators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def validate_nif(v)
value = v.upcase
return false unless value.match(/^[0-9]{8}[a-z]$/i)
letters = "TRWAGMYFPDXBNJZSQVHLCKE"
check = value.slice!(value.length - 1..value.length - 1)
check = value.slice!(value.length - 1)
calculated_letter = letters[value.to_i % 23].chr
return check === calculated_letter
end
Expand Down

0 comments on commit 2e61926

Please sign in to comment.