Class: UUIDGen::UUID
- Inherits:
-
Object
- Object
- UUIDGen::UUID
- Defined in:
- lib/uuidgen/uuid.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#decimal ⇒ Object
readonly
Returns the value of attribute decimal.
Instance Method Summary collapse
Instance Attribute Details
#decimal ⇒ Object (readonly)
Returns the value of attribute decimal.
3 4 5 |
# File 'lib/uuidgen/uuid.rb', line 3 def decimal @decimal end |
Instance Method Details
#eql?(other) ⇒ Boolean
20 21 22 |
# File 'lib/uuidgen/uuid.rb', line 20 def eql?(other) @decimal == other.decimal end |
#hash ⇒ Object
24 25 26 |
# File 'lib/uuidgen/uuid.rb', line 24 def hash @decimal.hash end |
#to_hex ⇒ Object
5 6 7 |
# File 'lib/uuidgen/uuid.rb', line 5 def to_hex @decimal.to_s(16).rjust(32, '0') end |
#to_s ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/uuidgen/uuid.rb', line 9 def to_s hex_string = to_hex '%s-%s-%s-%s-%s' % [ hex_string[0, 8], hex_string[8, 4], hex_string[12, 4], hex_string[16, 4], hex_string[20, 12] ] end |