Class: UUIDTools::UUID

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

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object


9
10
11
# File 'lib/activeuuid/uuid.rb', line 9

def as_json(options = nil)
  hexdigest.upcase
end

#quoted_idObject

monkey-patch Friendly::UUID to serialize UUIDs to MySQL


4
5
6
7
# File 'lib/activeuuid/uuid.rb', line 4

def quoted_id
  s = raw.unpack("H*")[0]
  "x'#{s}'"
end

#to_paramObject


13
14
15
# File 'lib/activeuuid/uuid.rb', line 13

def to_param
  hexdigest.upcase
end