Created
October 16, 2013 14:07
-
-
Save jamesduncombe/7008327 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
class FakerNames | |
FIRST_NAMES = %w(James Nathan Stew John Ben Adrian Will George) | |
LAST_NAMES = %w(Smith Goddard Duncombe Harrason Mandela James Boom Johnson) | |
attr_accessor :used_combos, :used_first_names, :used_last_names | |
def initialize | |
@used_combos = [] | |
@used_first_names = [] | |
@used_last_names = [] | |
@combinations = FIRST_NAMES.product(LAST_NAMES) | |
@total = @combinations.count | |
end | |
def full_name | |
@combinations[@used_combos] unless @used_combos == @total | |
@used_combos += 1 | |
end | |
private | |
def generate_name | |
"#{FIRST_NAMES.shuffle.first} #{LAST_NAMES.shuffle.first}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment