aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 2375e2f34b..c6ed947660 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1010,6 +1010,18 @@ rb_yield_values2(int argc, const VALUE *argv)
}
VALUE
+rb_yield_assoc_or_values(VALUE key, VALUE value)
+{
+ if (rb_block_arity() > 1) {
+ VALUE argv[2] = { key, value };
+ return rb_yield_0(2, argv);
+ }
+ else {
+ return rb_yield_1(rb_assoc_new(key, value));
+ }
+}
+
+VALUE
rb_yield_splat(VALUE values)
{
VALUE tmp = rb_check_array_type(values);