Sha256: ab5c26d570e3817c20fcfe382ae82fe67740663a4394e4bd55aacd8d0a526959

Contents?: true

Size: 487 Bytes

Versions: 49

Compression:

Stored size: 487 Bytes

Contents

class Cassandra
  # Abstract base class for comparable numeric column name types
  class Comparable
    class TypeError < ::TypeError #:nodoc:
    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)
      other.respond_to?(:to_i) && self.to_i == other.to_i
    end
    
    def to_s
      @bytes
    end
  end
end

Version data entries

49 entries across 49 versions & 7 rubygems

Version Path
cassandra-0.8.2 lib/cassandra/comparable.rb
cassandra-0.8.1 lib/cassandra/comparable.rb
cassandra-0.8.0 lib/cassandra/comparable.rb
cassandra-0.7.6 lib/cassandra/comparable.rb
cassandra-0.7.5 lib/cassandra/comparable.rb
cassandra-0.7.4 lib/cassandra/comparable.rb
cassandra-0.7.2 lib/cassandra/comparable.rb
cassandra-0.7.1 lib/cassandra/comparable.rb
cassandra-0.7 lib/cassandra/comparable.rb