Class: Salgo::Btree::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/salgo/btree.rb

Overview

The key value should support >, < and ==.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, val = true) ⇒ Key

Returns a new instance of Key.



167
168
169
170
# File 'lib/salgo/btree.rb', line 167

def initialize(key, val=true)
    @key = key
    @val = val
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



164
165
166
# File 'lib/salgo/btree.rb', line 164

def key
  @key
end

#valObject

Returns the value of attribute val.



164
165
166
# File 'lib/salgo/btree.rb', line 164

def val
  @val
end

Instance Method Details

#<(k) ⇒ Object



172
173
174
# File 'lib/salgo/btree.rb', line 172

def < (k)
    @key < k.key
end

#==(k) ⇒ Object



180
181
182
# File 'lib/salgo/btree.rb', line 180

def == (k)
    @key == k.key
end

#>(k) ⇒ Object



176
177
178
# File 'lib/salgo/btree.rb', line 176

def > (k)
    @key > k.key
end