Groups
Groups
Sign in
Groups
Groups
Ruby on Rails: Talk
Conversations
About
Send feedback
Help
TypeError: can't make subclass of Class
30 views
Skip to first unread message
John Merlino
unread,
Oct 6, 2012, 2:15:14 PM
10/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
Why can't a class be an instance of class Class and also inherit from
class Class in ruby?
Let's say I defined a singleton method on Class:
1.9.3p0 :032 > class Class
1.9.3p0 :033?> def Class.class_singleton
1.9.3p0 :034?> puts 'class singleton'
1.9.3p0 :035?> end
1.9.3p0 :036?> end
And I want to create a class that can inherit that singleton method:
1.9.3p0 :039 > class Q < Class
1.9.3p0 :040?> end
TypeError: can't make subclass of Class
How then could it be possible to access that singleton method without
directly calling it on Class? And why is inheriting from Class not
allowed?
Reply all
Reply to author
Forward
0 new messages