class OrderedRow

This class functions as a temporary representation of a row. The OrderedRow contains information about which column it should be sorted on, so that Comparable can be implemented.

Public Class Methods

new(my_array, index) click to toggle source

Creates a new OrderedRow. Callers must specify the index of the row element which will be used for order comparisons.

Attributes

my_array

An array representing a row from Table

index

A Fixnum value which represents the comparison value

# File lib/tablestakes.rb, line 722
def initialize(my_array, index)
  @data = my_array
  @sort_index = index
end

Public Instance Methods

<=>(other) click to toggle source

Implements comparable

Attributes

other

The row to be compared

# File lib/tablestakes.rb, line 739
def <=>(other)
  self.data[@sort_index] <=> other.data[@sort_index]
end
data() click to toggle source

Returns the row elements in an Array

Attributes

none

# File lib/tablestakes.rb, line 731
def data
  return @data
end