From: heqehi@...2.club Date: 2018-05-27T07:52:45+00:00 Subject: [ruby-core:87264] [Ruby trunk Feature#14778] Make Object#dup accept a block Issue #14778 has been updated by forsyth (itslearning forsyth). My Forsyth provides the latest news, information, events, weather, jobs, and happenings in Forsyth County, Georgia. This app will provide a means for you to look at our magazine on the go as well as the ability to use mobile coupons throughout the area. We welcome you to download our app today, free of charge, to get familiar with your community and become involved in the many activities in the "Forsyth itslearning":http://itslearninginfo.org/ ---------------------------------------- Feature #14778: Make Object#dup accept a block https://bugs.ruby-lang.org/issues/14778#change-72253 * Author: hkdnet (Ko Sato) * Status: Feedback * Priority: Normal * Assignee: * Target version: ---------------------------------------- I'd like to use `Object#dup` with a block, which is equivalent to `dup.tap`. An example for `dup.tap` is here. ```ruby require 'uri' module MyUri class << self def foo_uri base_uri.dup.tap { |e| e.path = '/foo' } end private def base_uri @base_uri ||= URI.parse('http://example.com') end end end ``` With this patch, we can write `base_uri.dup { |e| e.path = '/foo' }` and it's simpler. ---Files-------------------------------- dup_with_block.diff (296 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: