deps/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c
static mrb_value
hash_values_at(mrb_state *mrb, mrb_value hash)
{
  mrb_value *argv, result;
  mrb_int argc, i;
  int ai;

  mrb_get_args(mrb, "*", &argv, &argc);
  result = mrb_ary_new_capa(mrb, argc);
  ai = mrb_gc_arena_save(mrb);
  for (i = 0; i < argc; i++) {
    mrb_ary_push(mrb, result, mrb_hash_get(mrb, hash, argv[i]));
    mrb_gc_arena_restore(mrb, ai);
  }
  return result;
}
/*
 * call-seq:
 *   hsh.values_at(key, ...)   -> array
 *
 * Return an array containing the values associated with the given keys.
 * Also see <code>Hash.select</code>.
 *
 *   h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" }
 *   h.values_at("cow", "cat")  #=> ["bovine", "feline"]
 */


Return an array containing the values associated with the given keys.


Return an array containing the values associated with the given keys .
static mrb_value
hash_values_at(mrb_state *mrb, mrb_value hash)
{
  mrb_value *argv, result;
  mrb_int argc, i;
  int ai;
  mrb_get_args(mrb, "*", &argv, &argc);
  result = mrb_ary_new_capa(mrb, argc);
  ai = mrb_gc_arena_save(mrb);
  for (i = 0; i < argc; i++) {
    mrb_ary_push(mrb, result, mrb_hash_get(mrb, hash, argv[i]));
    mrb_gc_arena_restore(mrb, ai);
  }
  return result;
}
static mrb_value hash_values_at ( mrb_state * mrb , mrb_value hash ) { mrb_value * argv , result ; mrb_int argc , i ; int ai ; mrb_get_args ( mrb , " " , & argv , & argc ) ; result = mrb_ary_new_capa ( mrb , argc ) ; ai = mrb_gc_arena_save ( mrb ) ; for ( i = 0 ; i < argc ; i ++ ) { mrb_ary_push ( mrb , result , mrb_hash_get ( mrb , hash , argv [ i ] ) ) ; mrb_gc_arena_restore ( mrb , ai ) ; } return result ; }
call-seq:
   hsh.values_at(key, ...)   -> array
call - seq : hsh . values_at ( key ... ) - > array