Project

General

Profile

Feature #21455

Updated by leoarnold (Leo Arnold) 1 day ago

I sometimes come across code like this where 
 the `Array#join` at the end can easily 
 be overlooked or stands out like a sore thumb: 

 ```ruby 
 hex_string = string.bytes.map do |byte| 
   format('%02X', byte) 
 end.join(' ') 
 ``` 

 Pull Request: https://github.com/ruby/ruby/pull/13731 

 It seems idiomatic and more succinct 
 to pass the block to `Array#join` directly: 

 ```ruby 
 hex_string = string.bytes.join(' ') do |byte| 
   format('%02X', byte) 
 end 
 ``` 

 Pull Request: https://github.com/ruby/ruby/pull/13731

Back