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 ).
- #quoted_id ⇒ Object
- #to_param ⇒ Object
Class Method Details
.serialize(value) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/activeuuid/uuid.rb', line 24 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
16 17 18 |
# File 'lib/activeuuid/uuid.rb', line 16 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 |
#quoted_id ⇒ Object
11 12 13 14 |
# File 'lib/activeuuid/uuid.rb', line 11 def quoted_id s = raw.unpack("H*")[0] "x'#{s}'" end |
#to_param ⇒ Object
20 21 22 |
# File 'lib/activeuuid/uuid.rb', line 20 def to_param hexdigest.upcase end |