Created
July 15, 2009 00:35
-
-
Save bdimcheff/147345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_record | |
# Remove all non-digits from numeric attributes. | |
# Required in order to store data in Fannie Format | |
phones = %w{ | |
borrower_ssn | |
borrower_phone_cell | |
borrower_phone_home | |
borrower_phone_work | |
borrower_employer_phone | |
coborrower_ssn | |
coborrower_phone_cell | |
coborrower_phone_home | |
coborrower_phone_work | |
coborrower_employer_phone | |
} | |
phones.each do |attribute| | |
# Cycle through each attribute, and remove non-digits from the string. | |
if self.send(attribute) | |
self.send("#{attribute}=", self.send(attribute).gsub(/[^0-9]/, "") } | |
else | |
self.send("#{attribute}=", "") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment