Skip to content

Instantly share code, notes, and snippets.

@hughevans
Last active September 7, 2016 22:20
Show Gist options
  • Save hughevans/a7f38f348b946aa8cd6b696a168dab76 to your computer and use it in GitHub Desktop.
Save hughevans/a7f38f348b946aa8cd6b696a168dab76 to your computer and use it in GitHub Desktop.
Apple’s TOP SECRET product naming generator
def prefix
%w{Apple i Air Car Magic}.sample if rand(2) == 1
end
def middle
%w{Mac MacBook Pad Pod Pod Phone Mouse Watch Play}.sample
end
def ending
%w{Pro S SE Retina Air Plus}.sample if rand(2) == 1
end
def generate_names
[prefix, middle, ending].compact
end
def namify
if (name = generate_names).size > 1
name.join(' ')
else
namify
end
end
> 10.times { puts namify }
Apple MacBook S
Magic MacBook Air
Apple Phone
Air Phone
Air Pad Pro
Car Pod Pro
Car Mac
Phone Air
Watch SE
Magic Play
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment