Skip to content

Instantly share code, notes, and snippets.

@brittanmcg
Created December 3, 2013 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brittanmcg/7764627 to your computer and use it in GitHub Desktop.
Save brittanmcg/7764627 to your computer and use it in GitHub Desktop.
def grab_ssn(string)
ssn = /\d{3}-\d{2}-\d{4}/.match(string).to_s
if string.include?(ssn)
return ssn
else
return nil
end
end
#I keep on getting this message from the test "
Error!
grab_ssn returns nil if it doesn't have a SSN
expected: nil got: ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment