sort (KirbyBase::KBTable::KBResultSet)

    # File lib/kirbybase.rb, line 3711
        def sort(*sort_fields)
            sort_fields_arrs = []
            sort_fields.each do |f|
                if f.to_s[0..0] == '-'
                    sort_fields_arrs << [f.to_s[1..-1].to_sym, :desc]
                elsif f.to_s[0..0] == '+'
                    sort_fields_arrs << [f.to_s[1..-1].to_sym, :asc]
                else
                    sort_fields_arrs << [f, :asc]
                end
            end

            sort_fields_arrs.each do |f|
                raise "Invalid sort field" unless @filter.include?(f[0])
            end

            super() { |a,b|
                x = []
                y = []
                sort_fields_arrs.each do |s|
                    if [:Integer, :Float].include?(
                     @filter_types[@filter.index(s[0])])
                        a_value = a.send(s[0]) || 0
                        b_value = b.send(s[0]) || 0
                    else
                        a_value = a.send(s[0])
                        b_value = b.send(s[0])
                    end
                    if s[1] == :desc
                        x << b_value
                        y << a_value
                    else
                        x << a_value
                        y << b_value
                    end
                end

                x <=> y
            }
        end