ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:52436] [ruby-trunk - Feature #7876][Open] Add method for accessing Class from within Singleton Class
@ 2013-02-18 11:00 wardrop (Tom Wardrop)
  2013-02-22  0:06 ` [ruby-core:52650] [ruby-trunk - Feature #7876] " ko1 (Koichi Sasada)
  2013-02-22  1:51 ` [ruby-core:52670] " duerst (Martin Dürst)
  0 siblings, 2 replies; 3+ messages in thread
From: wardrop (Tom Wardrop) @ 2013-02-18 11:00 UTC (permalink / raw
  To: ruby-core


Issue #7876 has been reported by wardrop (Tom Wardrop).

----------------------------------------
Feature #7876: Add method for accessing Class from within Singleton Class
https://bugs.ruby-lang.org/issues/7876

Author: wardrop (Tom Wardrop)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


=begin
I'm quite surprised I haven't run into this sooner, but I seem to have just discovered that there's no means by which you can access the outer Class object once inside the context of the Singleton Class. Take the following example; how would I get a reference to (({Test})) from within the singleton?

  class Test
    class << self
      # How do I get a reference to Test from here?
    end
  end

I assume the answer is that there is no reliable way, hence the reason for this request. Could we add a method to the singleton class that allows access to the "outer" class, e.g.

  class Test
    class << self
      self.outerclass
    end
  end

Thoughts?
=end


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:52650] [ruby-trunk - Feature #7876] Add method for accessing Class from within Singleton Class
  2013-02-18 11:00 [ruby-core:52436] [ruby-trunk - Feature #7876][Open] Add method for accessing Class from within Singleton Class wardrop (Tom Wardrop)
@ 2013-02-22  0:06 ` ko1 (Koichi Sasada)
  2013-02-22  1:51 ` [ruby-core:52670] " duerst (Martin Dürst)
  1 sibling, 0 replies; 3+ messages in thread
From: ko1 (Koichi Sasada) @ 2013-02-22  0:06 UTC (permalink / raw
  To: ruby-core


Issue #7876 has been updated by ko1 (Koichi Sasada).

Category set to core
Assignee set to matz (Yukihiro Matsumoto)
Target version set to next minor


----------------------------------------
Feature #7876: Add method for accessing Class from within Singleton Class
https://bugs.ruby-lang.org/issues/7876#change-36735

Author: wardrop (Tom Wardrop)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


=begin
I'm quite surprised I haven't run into this sooner, but I seem to have just discovered that there's no means by which you can access the outer Class object once inside the context of the Singleton Class. Take the following example; how would I get a reference to (({Test})) from within the singleton?

  class Test
    class << self
      # How do I get a reference to Test from here?
    end
  end

I assume the answer is that there is no reliable way, hence the reason for this request. Could we add a method to the singleton class that allows access to the "outer" class, e.g.

  class Test
    class << self
      self.outerclass
    end
  end

Thoughts?
=end


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:52670] [ruby-trunk - Feature #7876] Add method for accessing Class from within Singleton Class
  2013-02-18 11:00 [ruby-core:52436] [ruby-trunk - Feature #7876][Open] Add method for accessing Class from within Singleton Class wardrop (Tom Wardrop)
  2013-02-22  0:06 ` [ruby-core:52650] [ruby-trunk - Feature #7876] " ko1 (Koichi Sasada)
@ 2013-02-22  1:51 ` duerst (Martin Dürst)
  1 sibling, 0 replies; 3+ messages in thread
From: duerst (Martin Dürst) @ 2013-02-22  1:51 UTC (permalink / raw
  To: ruby-core


Issue #7876 has been updated by duerst (Martin Dürst).


This should be possible with Module#ancestors. Maybe not totally slick, but possible.
----------------------------------------
Feature #7876: Add method for accessing Class from within Singleton Class
https://bugs.ruby-lang.org/issues/7876#change-36756

Author: wardrop (Tom Wardrop)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


=begin
I'm quite surprised I haven't run into this sooner, but I seem to have just discovered that there's no means by which you can access the outer Class object once inside the context of the Singleton Class. Take the following example; how would I get a reference to (({Test})) from within the singleton?

  class Test
    class << self
      # How do I get a reference to Test from here?
    end
  end

I assume the answer is that there is no reliable way, hence the reason for this request. Could we add a method to the singleton class that allows access to the "outer" class, e.g.

  class Test
    class << self
      self.outerclass
    end
  end

Thoughts?
=end


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-22  2:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-18 11:00 [ruby-core:52436] [ruby-trunk - Feature #7876][Open] Add method for accessing Class from within Singleton Class wardrop (Tom Wardrop)
2013-02-22  0:06 ` [ruby-core:52650] [ruby-trunk - Feature #7876] " ko1 (Koichi Sasada)
2013-02-22  1:51 ` [ruby-core:52670] " duerst (Martin Dürst)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).