CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=0, private, must-revalidate
content-type: text/html; charset=utf-8
etag: W/"e4d1271c62327e5e9c1c2ee83ff7b5e0"
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
referrer-policy: strict-origin-when-cross-origin
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=fGwJojOaMBhAd2v1cAv4A9QcsdbDgXCIuHrfqcfzy1I%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1753285406"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=fGwJojOaMBhAd2v1cAv4A9QcsdbDgXCIuHrfqcfzy1I%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1753285406"
server: Heroku
set-cookie: _redmine_session=TS8wQUdPTWNIVTdqRmo5eXlkanNONmRLbURsWkRyYVBoYk4rY0hmTG1CeCtIdVE1eWYxdjdkOGpQdmF3ZnBER0JubHliNGdPYzZTbVh1YVlESXFrK09mR2ZJNGF2RVdJeEpFaWg3UjdEUmU1RTgyYU1VbUtsdXBFVlVodkc0d0pmU0trMWlPMUEydmFubVhSTmQyZlphV2pBWU83cXM3S25ZcllzYlVXUGwyQUhwTzI3Tmt1UlB4RkhjY1VYZVV0LS1nbnIwYnRETTlvV2Q0M1d5OE90M3lnPT0%3D--8a5821e727e016981ba4d81bbf6a79f16a0eb772; path=/; secure; httponly; samesite=lax
strict-transport-security: max-age=63072000; includeSubDomains
vary: Accept
via: 2.0 heroku-router
x-content-type-options: nosniff
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-request-id: f27c60ca-8c5c-7979-9c46-9a7c8ccf9df5
x-runtime: 0.111927
x-xss-protection: 1; mode=block
content-length: 31877
date: Wed, 23 Jul 2025 15:43:26 GMT
Bug #21363: `Namespace.current` should always return the Namespace in which it was defined - Ruby - Ruby Issue Tracking System
[ruby-core:122240]
Project
General
Profile
Tags
Custom queries
Actions
Bug #21363
open`Namespace.current` should always return the Namespace in which it was defined
Added by tenderlovemaking (Aaron Patterson) 2 months ago. Updated about 2 months ago.
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-05-22T23:07:21Z rm-assertion 17e71c7a24) +PRISM [arm64-darwin24]
Tags:
Description
I think Namespace.current
should always return the namespace in which it was defined. Here is an example to demonstrate what I mean:
File.binwrite("ns.rb", <<-RUBY)
# namespace 3
module M
def self.test
p Namespace.current
end
TEST = -> {
p Namespace.current
}
end
RUBY
ns = Namespace.new
ns.load "./ns.rb"
p Namespace.current
ns::M.test
ns::M::TEST.call
I expect the output of ns::M.test
and ns::M::TEST.call
to be the same. Instead the output is like this:
#<Namespace:2,user,main>
#<Namespace:3,user,optional>
#<Namespace:2,user,main>
I think a method and lambda defined in the same namespace should return the same value for Namespace.current
Updated by tenderlovemaking (Aaron Patterson) 2 months ago
To be more specific, given this program:
File.binwrite("ns.rb", <<-RUBY)
# namespace 3
module M
def self.test
p test: Namespace.current
end
TEST = -> {
p lambda: Namespace.current
}
end
RUBY
ns = Namespace.new
ns.load "./ns.rb"
p main: Namespace.current
ns::M.test
ns::M::TEST.call
I expect the following output:
{main: #<Namespace:2,user,main>}
{test: #<Namespace:3,user,optional>}
{lambda: #<Namespace:3,user,optional>}
But I got the following output:
{main: #<Namespace:2,user,main>}
{test: #<Namespace:3,user,optional>}
{lambda: #<Namespace:2,user,main>}
Actions
Like0
Like0Like0
Powered by Redmine © 2006-2025 Jean-Philippe Lang
Loading...