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