Class: Array2Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/array2hash/version.rb,
ext/array2hash/array2hash.c

Constant Summary collapse

VERSION =
"0.1".freeze

Class Method Summary collapse

Class Method Details

.convertObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'ext/array2hash/array2hash.c', line 27

static VALUE __rubex_rb_f_Array2Hash_convert (int argc,VALUE* argv,VALUE __rubex_arg_self)
{
  VALUE __rubex_arg_a;
  long int __rubex_v_i;
  long int __rubex_v_j;
  VALUE __rubex_v_result;
  VALUE __rubex_temp_1;
  if (argc < 1)
  {
    rb_raise(rb_eArgError, "Need 1 args, not %d", argc);
  }

  __rubex_arg_a=argv[0];
  __rubex_v_i = NUM2LONG(rb_funcall(__rubex_arg_a, rb_intern("size"), 0, NULL));
  __rubex_v_j = 0;

  /* Rubex file location: /home/sameer/gitrepos/array2hash/ext/array2hash/array2hash.rubex:10 */
  __rubex_temp_1 = rb_hash_new();
  __rubex_v_result = __rubex_temp_1;
  __rubex_temp_1 = 0;
  __rubex_temp_1 = 0;
  while (( __rubex_v_j < __rubex_v_i ))
  {

    /* Rubex file location: /home/sameer/gitrepos/array2hash/ext/array2hash/array2hash.rubex:13 */
    rb_hash_aset(__rubex_v_result,RARRAY_AREF(__rubex_arg_a,__rubex_v_j),LONG2NUM(__rubex_v_j));

    /* Rubex file location: /home/sameer/gitrepos/array2hash/ext/array2hash/array2hash.rubex:14 */
    __rubex_v_j = ( __rubex_v_j + 1 );
  }


  /* Rubex file location: /home/sameer/gitrepos/array2hash/ext/array2hash/array2hash.rubex:17 */
  return __rubex_v_result;
}