Skip to content

Instantly share code, notes, and snippets.

@brapse
Created November 27, 2009 17:01
Show Gist options
  • Save brapse/244120 to your computer and use it in GitHub Desktop.
Save brapse/244120 to your computer and use it in GitHub Desktop.
product_format = /(FIXED|ARM)-(\d{1,2})(?:-(REFINANCE|PURCHASE))?(?:-(FHA))?(?:-(JUMBO))?/
product_format_mapping = {:interest_type => 1, :term => 2, :mortgage_type => 3, :fha => 4, :jumbo => 5 }
product_hash = {}
product_format_mapping.map do |field, index|
product_hash[field] = product_string.match(product_format)[index]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment