Module: TeRex::AlphaNum

Defined in:
lib/te_rex/alpha_num.rb

Class Method Summary collapse

Class Method Details

.dateObject

Some randomized date format generator.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/te_rex/alpha_num.rb', line 13

def self.date
  day = (1..31).map{|num| num}.sample
  month = (1..12).map{|num| num}.sample
  year2 = (10..99).map{|num| num}.sample
  year4 = (1900..2099).map{|n| n}.sample
  ["#{day}-#{month}-#{year2}",
  "#{day}/#{month}/#{year2}",
  "#{day}/#{month}/#{year4}",
  "#{day}-#{month}-#{year4}",
  "#{year4}-#{month}-#{day}",
  "#{year4}/#{month}/#{day}",
  "#{year2}/#{month}/#{day}",
  "#{year2}-#{month}-#{day}",
  "#{month}-#{day}-#{year2}",
  "#{month}/#{day}/#{year2}",
  "#{month}/#{day}/#{year4}",
  "#{month}-#{day}-#{year4}",
  "#{year4}-#{day}-#{month}",
  "#{year4}/#{day}/#{month}",
  "#{year2}/#{day}/#{month}",
  "#{year2}-#{day}-#{month}"].sample
end

.genObject



5
6
7
8
9
10
# File 'lib/te_rex/alpha_num.rb', line 5

def self.gen
  ('a'..'z').map{|aleph| aleph}
  .concat(('A'..'Z').map{|aleph2| aleph2})
  .concat(@symbols)
  .concat((1..20).map{|num| num})
end