class CodeGenerator
generates a random code of 4 characters
Attributes
array[R]
new_code[R]
Public Class Methods
new()
click to toggle source
# File lib/code_generator.rb, line 7 def initialize @array = ['r','r','r','r','g','g','g','g','b','b','b','b','y','y','y','y'] @new_code = [] end
Public Instance Methods
secret_code()
click to toggle source
# File lib/code_generator.rb, line 12 def secret_code @new_code = @array.shuffle!.pop(4) #could use shift instead of pop? end