Module: Contrast::Extension::Assess::ContrastArray

Defined in:
lib/contrast/extension/assess/array.rb,
ext/cs__assess_array/cs__assess_array.c

Overview

Helper module to call cs__join

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cs__join(*args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'ext/cs__assess_array/cs__assess_array.c', line 34

static VALUE contrast_assess_prepend_array_join(const int argc,
                                                const VALUE *argv,
                                                const VALUE ary) {
    VALUE sep, result;
    /* We need to figure out the separator the join method actually used. */
    /* First, check if one was provided. */
    rb_scan_args(argc, argv, "01", &sep);
    /* Second, check to see if `$;` is set*/
    if (NIL_P(sep)) {
        sep = rb_output_fs;
    }

    /* call the Array.join but patched one */
    result = rb_ary_join(ary, sep);
    /* call the Contrast::Extensions::Assess::ArrayPropagator#cs__track_join */
    result = rb_funcall(array_propagator, rb_sym_assess_track_array_join, 3,
                        ary, sep, result);

    /*call original occurs in ruby*/
    return Qtrue;
}

Instance Method Details

#join(*args) ⇒ Object



68
69
70
71
# File 'lib/contrast/extension/assess/array.rb', line 68

def join *args
  cs__join(*args)
  super(*args)
end