module RbNaCl::KeyComparator
def <=>(other)
-
(nil)
- if comparison doesn't make sense -
(-1)
- if the key is smaller than the other key -
(1)
- if the key is larger than the other key -
(0)
- if the keys are equal
Parameters:
-
other
(KeyComparator, #to_str
) -- The thing to compare
def <=>(other) if KeyComparator > other.class other = other.to_bytes elsif other.respond_to?(:to_str) other = other.to_str else return nil end compare32(other) end
def ==(other)
-
(false)
- if they keys are not equal -
(true)
- if the keys are equal
Parameters:
-
other
(KeyComparator, #to_str
) -- The thing to compare
def ==(other) if KeyComparator > other.class other = other.to_bytes elsif other.respond_to?(:to_str) other = other.to_str else return false end Util.verify32(to_bytes, other) end
def compare32(other)
def compare32(other) if Util.verify32(to_bytes, other) 0 elsif to_bytes > other 1 else -1 end end