module VersionSorter

Public Class Methods

compare(p1, p2) click to toggle source
static VALUE
rb_version_compare(VALUE rb_self, VALUE rb_version_a, VALUE rb_version_b)
{
        int exception;
        struct compare_context context = {
                rb_version_a, rb_version_b,
                NULL, NULL,
        };

        VALUE result = rb_protect(rb_version_compare_cb, (VALUE)&context, &exception);

        xfree(context.version_a);
        xfree(context.version_b);

        if (exception) {
                rb_jump_tag(exception);
        }

        return result;
}
rsort(p1) click to toggle source
static VALUE
rb_version_sort_r(VALUE rb_self, VALUE rb_versions)
{
        return rb_version_sort_1(rb_self, rb_ary_dup(rb_versions), version_compare_cb_r);
}
rsort!(p1) click to toggle source
static VALUE
rb_version_sort_r_bang(VALUE rb_self, VALUE rb_versions)
{
        return rb_version_sort_1(rb_self, rb_versions, version_compare_cb_r);
}
sort(p1) click to toggle source
static VALUE
rb_version_sort(VALUE rb_self, VALUE rb_versions)
{
        return rb_version_sort_1(rb_self, rb_ary_dup(rb_versions), version_compare_cb);
}
sort!(p1) click to toggle source
static VALUE
rb_version_sort_bang(VALUE rb_self, VALUE rb_versions)
{
        return rb_version_sort_1(rb_self, rb_versions, version_compare_cb);
}