Sha256: 3c5ef23ec4173746072d1c9adace5600fe7d6cb9b9de98266203bd793874cae6

Contents?: true

Size: 450 Bytes

Versions: 2

Compression:

Stored size: 450 Bytes

Contents

class Cassandra
  # Abstract base class for comparable numeric column name types
  class Comparable
    class TypeError < ::TypeError
    end
  
    def <=>(other)
      self.to_i <=> other.to_i
    end
    
    def hash
      @bytes.hash
    end
    
    def eql?(other)
      other.is_a?(Comparable) and @bytes == other.to_s
    end    
    
    def ==(other)
      self.to_i == other.to_i
    end
    
    def to_s
      @bytes
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
slillibri-cassandra-0.4 lib/cassandra/comparable.rb
cassandra-0.4 lib/cassandra/comparable.rb