@@ -328,54 +328,6 @@ hash_key(mrb_state *mrb, mrb_value hash)
328328return search.found ? search.result : mrb_nil_value();
329329}
330330331-/*
332- * call-seq:
333- * hsh.deconstruct_keys(keys) -> hash
334- *
335- * Returns a hash containing the contents of hsh for the given keys.
336- *
337- * If keys is nil, returns the hash itself.
338- * If keys is an array, returns a new hash containing only the specified keys.
339- *
340- * h = { a: 1, b: 2, c: 3, d: 4 }
341- * h.deconstruct_keys([:a, :c]) #=> { a: 1, c: 3 }
342- * h.deconstruct_keys(nil) #=> { a: 1, b: 2, c: 3, d: 4 }
343- * h.deconstruct_keys([:x, :y]) #=> { x: nil, y: nil }
344- */
345-static mrb_value
346-hash_deconstruct_keys(mrb_state *mrb, mrb_value hash)
347-{
348-mrb_value keys;
349-mrb_value result;
350-mrb_int i, len;
351-352-mrb_get_args(mrb, "o", &keys);
353-354-/* If keys is nil, return the hash itself */
355-if (mrb_nil_p(keys)) {
356-return hash;
357- }
358-359-/* Keys must be an array */
360-if (!mrb_array_p(keys)) {
361-mrb_raisef(mrb, E_TYPE_ERROR, "wrong argument type %C (expected Array or nil)",
362-mrb_obj_class(mrb, keys));
363- }
364-365-/* Create result hash */
366-result = mrb_hash_new(mrb);
367-len = RARRAY_LEN(keys);
368-369-/* Extract specified keys */
370-for (i = 0; i < len; i++) {
371-mrb_value key = mrb_ary_ref(mrb, keys, i);
372-mrb_value val = mrb_hash_get(mrb, hash, key);
373-mrb_hash_set(mrb, result, key, val);
374- }
375-376-return result;
377-}
378-379331/*
380332 * call-seq:
381333 * hsh.__merge(*others) -> hsh
@@ -425,7 +377,6 @@ mrb_mruby_hash_ext_gem_init(mrb_state *mrb)
425377mrb_define_method_id(mrb, h, MRB_SYM_B(slice), hash_slice_bang, MRB_ARGS_ANY());
426378mrb_define_method_id(mrb, h, MRB_SYM(except), hash_except, MRB_ARGS_ANY());
427379mrb_define_method_id(mrb, h, MRB_SYM(key), hash_key, MRB_ARGS_REQ(1));
428-mrb_define_method_id(mrb, h, MRB_SYM(deconstruct_keys), hash_deconstruct_keys, MRB_ARGS_REQ(1));
429380mrb_define_method_id(mrb, h, MRB_SYM(__merge), hash_merge, MRB_ARGS_ANY());
430381mrb_define_class_method_id(mrb, h, MRB_OPSYM(aref), hash_s_create, MRB_ARGS_ANY());
431382}