From: irohiroki@... Date: 2018-03-30T06:52:44+00:00 Subject: [ruby-core:86403] [Ruby trunk Feature#14625] yield_self accepts an argument, calling to_proc Issue #14625 has been updated by irohiroki (Hiroki Yoshioka). shevegen, That's what I meant to say. Thank you. ---------------------------------------- Feature #14625: yield_self accepts an argument, calling to_proc https://bugs.ruby-lang.org/issues/14625#change-71332 * Author: irohiroki (Hiroki Yoshioka) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Currently, yield_self doesn't accept any argument other than a block. But there are situations where I would like to pass a method object to yield_self. e.g. ~~~ ruby result = collection .yield_self(&method(:filter1)) .yield_self(&method(:filter2)) ~~~ Of course, we can get the same result with ~~~ ruby result = filter2(filter1(collection)) ~~~ but the order of reading/writing doesn't match the order of thinking. My request is for yield_self to accept a proc-ish object and call to_proc on it so that we can write the code as shown below, which is more readable. ~~~ ruby result = collection .yield_self(method :filter1) .yield_self(method :filter2) ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: