Actions
Feature #11905
closedChange the 'class' keyword to return a symbol
Status:
Closed
Assignee:
-
Target version:
-
Description
Currently the class
keyword returns nil:
class Person; end # => nil
It would be great if it could return a symbol instead:
class Person; end # => :Person
If we make it so we'll be able to do something like below:
private_constant class User
...
end
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Related to Feature #8839: Class and module should return the class or module that was opened added
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
It returns the last value inside the block, as well as begin
/end
block, not nil
.
Updated by yuki24 (Yuki Nishijima) almost 10 years ago
- Status changed from Open to Closed
I am totally aware of the current behaviour that you mentioned, but I'll close this issue since this is a duplicate.
Actions
Like0
Like0Like0Like0