module Medic::Sort

Constants

SORT_IDENTIFIERS

Public Instance Methods

sort_descriptors(symbols, ascending=true) click to toggle source
# File lib/medic/sort.rb, line 9
def sort_descriptors(symbols, ascending=true)
  Array(symbols).map do |sym|
    if sym.is_a? NSSortDescriptor
      sym
    else
      NSSortDescriptor.alloc.initWithKey(sort_identifier(sym), ascending: ascending)
    end
  end
end
sort_identifier(sort_id) click to toggle source
# File lib/medic/sort.rb, line 19
def sort_identifier(sort_id)
  sort_id.is_a?(Symbol) ? SORT_IDENTIFIERS[sort_id] : sort_id
end