Class: SUID

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

Constant Summary

VERSION =
"1.0.1"
@@chars62 =
('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSUID

Returns a new instance of SUID



2
3
4
# File 'lib/suid.rb', line 2

def initialize
  @value = rand(0xffffffffffffffff)
end

Class Method Details

.generateObject



14
15
16
# File 'lib/suid.rb', line 14

def self.generate
  new.to_s
end

Instance Method Details

#to_iObject



10
11
12
# File 'lib/suid.rb', line 10

def to_i
  @value
end

#to_sObject



6
7
8
# File 'lib/suid.rb', line 6

def to_s
  @str ||= to_string
end