[#82518] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — mame@...
Issue #13618 has been updated by mame (Yusuke Endoh).
5 messages
2017/08/30
[#82552] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2017/08/31
[email protected] wrote:
[#82756] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wrong <normalperson@...>
2017/09/12
Eric Wrong <[email protected]> wrote:
[ruby-core:82330] [Ruby trunk Bug#13799] ENV.dup returns a plain Object
From:
hanmac@...
Date:
2017-08-10 14:42:21 UTC
List:
ruby-core #82330
Issue #13799 has been updated by Hanmac (Hans Mackowiak).
the Problem:
ENV is an Hash-like Object with having singleton methods to look like an Hash, but isn't one
dup does make a copy of an object of the same class, in that case useless because you don't want an Object and the singleton methods are not copied
what you can do is using ENV.to_h which does return an Hash as you want
----------------------------------------
Bug #13799: ENV.dup returns a plain Object
https://bugs.ruby-lang.org/issues/13799#change-66128
* Author: sylvain.joyeux (Sylvain Joyeux)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.9, 2.2.5, 2.3.3, 2.4.1
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I was doing ENV.dup to get a copy of the environment that can be modified without affecting ENV. However, ENV.dup returns a plain Object
~~~
irb(main):005:0> ENV.dup
=> #<Object:0x00000002024fc0>
irb(main):006:0> ENV.dup['PATH']
NoMethodError: undefined method `[]' for #<Object:0x000000020446e0>
from (irb):6
from /home/doudou/.rbenv/versions/2.4.1/bin/irb:11:in `<main>'
irb(main):007:0>
~~~
The only way I found to get a copy is Hash[ENV]
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>