to_h()
public
Returns self. If called on a subclass of Hash, converts the receiver to a Hash object.
If a block is given, the results of the block on each pair of the receiver will be used as pairs.
static VALUE
rb_hash_to_h(VALUE hash)
{
if (rb_block_given_p()) {
return rb_hash_to_h_block(hash);
}
if (rb_obj_class(hash) != rb_cHash) {
const VALUE flags = RBASIC(hash)->flags;
hash = hash_dup(hash, rb_cHash, flags & HASH_PROC_DEFAULT);
}
return hash;
}