Class: UUID

Inherits:
Object
  • Object
show all
Defined in:
lib/clarity_tracking_number/ruby_core_extensions.rb

Class Method Summary collapse

Class Method Details

.clear_bank_tracking_numberObject



23
24
25
# File 'lib/clarity_tracking_number/ruby_core_extensions.rb', line 23

def self.clear_bank_tracking_number
  random_string(10)
end

.clear_check_tracking_numberObject



19
20
21
# File 'lib/clarity_tracking_number/ruby_core_extensions.rb', line 19

def self.clear_check_tracking_number
  random_string(6)
end

.random_string(n = 10) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/clarity_tracking_number/ruby_core_extensions.rb', line 2

def self.random_string(n=10)
  max = 32**n
  @chars = ('a'..'z').to_a + ('0'..'9').to_a - ['i', 'l', 'o', 'u']
  ans = ''
  r = rand(max)
  n.times do
    i = r % 32
    r /= 32
    ans << @chars[i]
  end
  ans
end

.random_tracking_numberObject



15
16
17
# File 'lib/clarity_tracking_number/ruby_core_extensions.rb', line 15

def self.random_tracking_number
  random_string(10)
end