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

#<=>(other) ⇒ Object



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

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

#==(other) ⇒ Object



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

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

#eql?(other) ⇒ Boolean

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

#hashObject



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

def hash
  @bytes.hash
end

#to_sObject



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

def to_s
  @bytes
end