From: sawadatsuyoshi@... Date: 2019-08-14T21:24:22+00:00 Subject: [ruby-core:94358] [Ruby master Feature#16104] Introduce merge_if and merge_if! Issue #16104 has been updated by sawa (Tsuyoshi Sawada). Do ```ruby a.each_with_object(b: 'Ball') {|(k, v), h| h[k] = v if v == 'Apple'} ``` or ```ruby {b: 'Ball'}.merge(a.select{|k, v| v == 'Apple'}) ``` ---------------------------------------- Feature #16104: Introduce merge_if and merge_if! https://bugs.ruby-lang.org/issues/16104#change-80765 * Author: akash (Akash Gupta) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- The method `merge_if` / `merge_if` will merge the passed hash in parameter only if the block evaluates to true, otherwise not. Similar to `count` method with a block. -- https://bugs.ruby-lang.org/ Unsubscribe: