Project

General

Profile

Actions

Feature #7388

closed

Object#embed

Added by zzak (Zachary Scott) over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Priority:
Normal
Target version:
[ruby-core:49536]

Description

=begin
From github:
https://github.com/ruby/ruby/pull/67

Add Object#embed which works like tap but returns the block's value

This avoids breaking from method chains in many cases. I don't see any other way to do this without this method.

Can someone confirm pull request are a valid way of submitting patches ? I cannot register on the mailing list for some reason, it seems to be broken.

Example:

(({[ 1, 2, 3, 4].select{|x| x.odd?}.embed{|x| {:total => x.count, :data => x}}}))
=end


Files

object_embed.patch (1.74 KB) object_embed.patch zzak (Zachary Scott), 11/19/2012 07:40 AM

Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #6721: Object#yield_selfClosedmatz (Yukihiro Matsumoto)Actions
Has duplicate Ruby master - Feature #12760: Optional block argument for `itself`ClosedActions
Actions

Also available in: Atom PDF