module TreeMap::Relation

Constants

CEILING
CREATE
EQUAL
FLOOR
HIGHER
LOWER

Public Class Methods

for_order(relation, ascending) click to toggle source
# File lib/treemap/tree_map.rb, line 19
def self.for_order(relation, ascending)
  if ascending
    relation
  else
    case relation
    when LOWER
      HIGHER
    when FLOOR
      CEILING
    when EQUAL
      EQUAL
    when CEILING
      FLOOR
    when HIGHER
      LOWER
    else
      raise "Unknown relation: #{relation.inspect}"
    end
  end
end