Last active
November 9, 2017 14:31
-
-
Save mmar/bb993532bc560982cf51 to your computer and use it in GitHub Desktop.
Try to guess names from email addresses in Ruby
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
## Usage: "[email protected]".guess_name_from_email | |
class String | |
def guess_name_from_email | |
self.split('@')[0].split('.').instance_exec { [ shift, pop ] }.compact.map { |n| n.capitalize }.join(' ') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment