Method: SimpleUUID::UUID#<=>
- Defined in:
- lib/simple_uuid.rb
#<=>(other) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/simple_uuid.rb', line 119 def <=>(other) me = to_s.unpack('Nn2C*') him = other.to_s.unpack('Nn2C*') # swap most significant time bits to front me[0], me[2], him[0], him[2] = me[2], me[0], him[2], him[0] me.zip(him) do |m, h| comp = m <=> h return comp if comp != 0 end return 0 end |