Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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