Skip to content

Instantly share code, notes, and snippets.

@jamesduncombe
Created October 16, 2013 14:07
Show Gist options
  • Save jamesduncombe/7008327 to your computer and use it in GitHub Desktop.
Save jamesduncombe/7008327 to your computer and use it in GitHub Desktop.
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