module Aquarium::Aspects::Advice

Constants

KINDS_IN_PRIORITY_ORDER
UNKNOWN_ADVICE_KIND

Public Class Methods

compare_advice_kinds(kind1, kind2) click to toggle source
# File lib/aquarium/aspects/advice.rb, line 27
def self.compare_advice_kinds kind1, kind2
  if kind1.nil?
    return kind2.nil? ? 0 : -1
  end
  return 1 if kind2.nil?
  if kind1.eql?(UNKNOWN_ADVICE_KIND)
    return kind2.eql?(UNKNOWN_ADVICE_KIND) ? 0 : -1
  else
    return kind2.eql?(UNKNOWN_ADVICE_KIND) ? 1 : KINDS_IN_PRIORITY_ORDER.index(kind1) <=> KINDS_IN_PRIORITY_ORDER.index(kind2)
  end
end
debug_backtraces() click to toggle source
# File lib/aquarium/aspects/advice.rb, line 16
def self.debug_backtraces; @DEBUG_BACKTRACES; end
debug_backtraces=( val ) click to toggle source
# File lib/aquarium/aspects/advice.rb, line 17
def self.debug_backtraces=( val ); @DEBUG_BACKTRACES = val; end
kinds() click to toggle source
# File lib/aquarium/aspects/advice.rb, line 19
def self.kinds; KINDS_IN_PRIORITY_ORDER; end
sort_by_priority_order(advice_kinds) click to toggle source
# File lib/aquarium/aspects/advice.rb, line 21
def self.sort_by_priority_order advice_kinds
  advice_kinds.sort do |x,y| 
    KINDS_IN_PRIORITY_ORDER.index(x.to_sym) <=> KINDS_IN_PRIORITY_ORDER.index(y.to_sym)
  end.map {|x| x.to_sym}
end