[#79440] [Ruby trunk Bug#13188] Reinitialize Ruby VM. — shyouhei@...
Issue #13188 has been updated by Shyouhei Urabe.
6 messages
2017/02/06
[#79441] Re: [Ruby trunk Bug#13188] Reinitialize Ruby VM.
— SASADA Koichi <ko1@...>
2017/02/06
On 2017/02/06 10:10, shyouhei@ruby-lang.org wrote:
[#79532] Immutable Strings vs Symbols — Daniel Ferreira <subtileos@...>
Hi,
15 messages
2017/02/15
[#79541] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/15
Em 15-02-2017 05:05, Daniel Ferreira escreveu:
[#79543] Re: Immutable Strings vs Symbols
— Daniel Ferreira <subtileos@...>
2017/02/16
Hi Rodrigo,
[#79560] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/16
Em 15-02-2017 22:39, Daniel Ferreira escreveu:
[ruby-core:79415] [Ruby trunk Bug#13169] Fix OpenStruct#each_pair return value
From:
ruby-core@...
Date:
2017-02-03 18:27:39 UTC
List:
ruby-core #79415
Issue #13169 has been updated by Marc-Andre Lafortune.
Thank you for the great patch :-)
----------------------------------------
Bug #13169: Fix OpenStruct#each_pair return value
https://bugs.ruby-lang.org/issues/13169#change-62845
* Author: Marcus Stollsteimer
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
```
ostruct.rb: fix OpenStruct#each_pair return value
* lib/ostruct.rb (OpenStruct#each_pair): let #each_pair
with block return self instead of the internal hash table.
```
Currently OpenStruct#each_pair with block returns the internal hash table, while usually #each, #each_key, #each_byte, and similar methods return `self`. Struct#each_pair also returns `self`.
```
require "ostruct"
person = OpenStruct.new(name: "John", age: 70)
person # => #<OpenStruct name="John", age=70>
person.each_pair { } # => {:name=>"John", :age=>70}
```
I don't know whether this is intended behavior or only an oversight.
The patch makes OpenStruct#each_pair return `self`, and also adds a test. (I do not know anything about how tests/specs in the Ruby source are organized, I hope it's fine.)
---Files--------------------------------
ostruct_each_pair.patch (908 Bytes)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>