Class: Identifier::UUID::Random

Inherits:
Object
  • Object
show all
Defined in:
lib/identifier/uuid/random.rb

Direct Known Subclasses

Substitute::Random

Defined Under Namespace

Modules: Substitute

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure(receiver, attr_name = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/identifier/uuid/random.rb', line 16

def self.configure(receiver, attr_name=nil)
  instance = new

  if attr_name.nil?
    if receiver.respond_to?(:identifier)
      attr_name = :identifier
    else
      attr_name = :uuid
    end
  end

  receiver.send "#{attr_name}=", instance

  instance
end

.getObject



8
9
10
# File 'lib/identifier/uuid/random.rb', line 8

def self.get
  UUID.format(raw)
end

.rawObject



12
13
14
# File 'lib/identifier/uuid/random.rb', line 12

def self.raw
  SecureRandom.uuid
end

Instance Method Details

#getObject



4
5
6
# File 'lib/identifier/uuid/random.rb', line 4

def get
  self.class.get
end