From: Zachary Scott Date: 2012-10-14T09:35:57+09:00 Subject: [ruby-core:47968] Re: [ruby-trunk - Bug #7157][Open] Ruby ignores Kernel#gsub block The docs for Kernel#gsub mention: "Equivalent to $_.gsub..., except that $_ receives the modified result. Available only when -p/-n command line option specified." On Sat, Oct 13, 2012 at 8:14 PM, popoxee (Bruce Metz) wrote: > > Issue #7157 has been reported by popoxee (Bruce Metz). > > ---------------------------------------- > Bug #7157: Ruby ignores Kernel#gsub block > https://bugs.ruby-lang.org/issues/7157 > > Author: popoxee (Bruce Metz) > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux] > > > When working with command line and use Kernel#gsub, ruby ignores the block if given. > > Reproduce code: > > Test text file: > File name: > test > File Content: > test > > Test Command line input: > > ruby -pe 'gsub(/t([a-z])s/){"d"+$1.capitalize}' test > > Expected output: > > dEt > > Actual output: > > # > > > > -- > http://bugs.ruby-lang.org/ >