Creating a list of A-Z and 0-9 is very simple in Ruby. You may need to do this for numerous reasons but the writing of this tip came about when needing to create a memorable word interface, like that of banks.
Ruby has great list capabilities, for example listing 0-9 is as simple as:
1 2 3
0..9.each do |n| puts n end
Doing so with the alphabet is just as easy:
1 2 3
('A'..'Z').to_a.each do |l| puts l end
To create an array of both A-Z and 0-9 together the following can be used:
list = ('A'...'Z').to_a + (0..9).to_a
It’s that simple!