Sha256: 5abe538920a1cf79f7b63321e95e588e07ba63982eeefbd93c4b4c8ac7c7a139

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

#include "cruby.h"

// TODO: Use vm_concat_array after Ruby 2.5
VALUE
llrb_insn_concatarray(VALUE ary1, VALUE ary2st)
{
  const VALUE ary2 = ary2st;
  VALUE tmp1 = rb_check_convert_type(ary1, T_ARRAY, "Array", "to_a");
  VALUE tmp2 = rb_check_convert_type(ary2, T_ARRAY, "Array", "to_a");

  if (NIL_P(tmp1)) {
    tmp1 = rb_ary_new3(1, ary1);
  }

  if (NIL_P(tmp2)) {
    tmp2 = rb_ary_new3(1, ary2);
  }

  if (tmp1 == ary1) {
    tmp1 = rb_ary_dup(ary1);
  }
  return rb_ary_concat(tmp1, tmp2);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
llrb-0.0.1 ext/llrb_insn_concatarray.c