Class: Cassandra::Comparable

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra/comparable.rb

Overview

Abstract base class for comparable numeric column name types

Direct Known Subclasses

Long

Defined Under Namespace

Classes: TypeError

Instance Method Summary (collapse)

Instance Method Details

- (Object) <=>(other)



8
9
10
# File 'lib/cassandra/comparable.rb', line 8

def <=>(other)
  self.to_i <=> other.to_i
end

- (Object) ==(other)



20
21
22
# File 'lib/cassandra/comparable.rb', line 20

def ==(other)
  other.respond_to?(:to_i) && self.to_i == other.to_i
end

- (Boolean) eql?(other)

Returns:

  • (Boolean)


16
17
18
# File 'lib/cassandra/comparable.rb', line 16

def eql?(other)
  other.is_a?(Comparable) and @bytes == other.to_s
end

- (Object) hash



12
13
14
# File 'lib/cassandra/comparable.rb', line 12

def hash
  @bytes.hash
end

- (Object) to_s



24
25
26
# File 'lib/cassandra/comparable.rb', line 24

def to_s
  @bytes
end