Class: UUIDTools::UUID
- Inherits:
-
Object
- Object
- UUIDTools::UUID
- Defined in:
- lib/activeuuid/uuid.rb
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
-
#gsub ⇒ Object
duck typing activerecord 3.1 dirty hack ).
- #next ⇒ Object
- #quoted_id ⇒ Object
- #to_param ⇒ Object
Class Method Details
.serialize(value) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/activeuuid/uuid.rb', line 28 def self.serialize(value) case value when self value when String parse_string value else nil end end |
Instance Method Details
#as_json(options = nil) ⇒ Object
20 21 22 |
# File 'lib/activeuuid/uuid.rb', line 20 def as_json( = nil) hexdigest.upcase end |
#gsub ⇒ Object
duck typing activerecord 3.1 dirty hack )
9 |
# File 'lib/activeuuid/uuid.rb', line 9 def gsub *; self; end |
#next ⇒ Object
11 12 13 |
# File 'lib/activeuuid/uuid.rb', line 11 def next self.class.random_create end |
#quoted_id ⇒ Object
15 16 17 18 |
# File 'lib/activeuuid/uuid.rb', line 15 def quoted_id s = raw.unpack("H*")[0] "x'#{s}'" end |
#to_param ⇒ Object
24 25 26 |
# File 'lib/activeuuid/uuid.rb', line 24 def to_param hexdigest.upcase end |