Class: WOoo::Utility::CodeGenerator
- Inherits:
-
Object
- Object
- WOoo::Utility::CodeGenerator
- Defined in:
- lib/wo_oo/util/code_generator.rb
Class Method Summary collapse
-
.human_code_elements ⇒ Object
----------------------------------------------------------------.
-
.new_computer_code(char_count = 30) ⇒ Object
----------------------------------------------------------------.
-
.new_human_code(number_elements = 6) ⇒ Object
----------------------------------------------------------------.
Class Method Details
.human_code_elements ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/wo_oo/util/code_generator.rb', line 38 def self.human_code_elements if @@human_code_elements == nil @@human_code_elements = [] for consonant in @@consonants for vowel in @@vowels @@human_code_elements << consonant + vowel end end 0.upto(9) {|index| @@human_code_elements << index.to_s } end return @@human_code_elements end |
.new_computer_code(char_count = 30) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/wo_oo/util/code_generator.rb', line 15 def self.new_computer_code(char_count = 30) code = '' char_count.times { code += @@computer_code_elements[Kernel::rand(@@computer_code_elements.length)] } return code end |
.new_human_code(number_elements = 6) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/wo_oo/util/code_generator.rb', line 5 def self.new_human_code(number_elements = 6) code = '' number_elements.times { code += CodeGenerator.human_code_elements[Kernel::rand(@@human_code_elements.length)] } return code end |