[BUG][PATCH] Class variables not available through modules
Reported by farleyknight | February 3rd, 2008 @ 09:06 AM | in 1.0 preview
Currently class variables which have been created in a module, and then included or extended by an instance of Class, are not available. An example:
module M
@@cvar = :cvar
end
class C; end
C.include(M)
# The cvar is found
C.class_variables => ["@@cvar"]
# But is not accessable
C.class_variable_get("@@cvar") => # raises 'class variable not found'
C.extend(M)
C.class_variable_get("@@cvar") => # also raises 'class variable not found'
A patch is forthcoming.. Still learning git..
Comments and changes to this ticket
-

farleyknight February 3rd, 2008 @ 09:42 AM
Not quite sure how to get these two commits formatted as one patch, but here's the first
-

-

farleyknight February 4th, 2008 @ 04:08 AM
- → Title changed from [BUG] Class variables not available through modules to [BUG][PATCH] Class variables not available through modules
Included a patch for this.. Let me know if it's satisfactory.
-
zimbatm February 4th, 2008 @ 03:13 PM
- → State changed from new to open
Thanks for participating. I took a look at your patches. You should probably move the fixture with the spec patch, which already looks fine. I don't have enough insight to approve the first patch. The best would be if you could come to the #rubinius channel and nag somebody like evan or rue to review it.
-
Ryan Davis February 29th, 2008 @ 03:23 PM
- → Assigned user changed from to Brian Ford
Brian was just looking at a similar issue (and I just assigned him a similar bug). Please merge the two if they're the same.
-
Brian Ford March 17th, 2008 @ 11:24 AM
- → State changed from open to resolved
At least in 1.8.6p111, I do not see that extending a class with a module that defines class variables makes those variables available to the class.
See commit 62687753 for specs and code related to this ticket.
-

farleyknight March 17th, 2008 @ 11:34 AM
Wow.. this was a long time ago. I believe the issue was trying to get RubyGems to install via setup.rb, and it was tripping over something in the RDoc.. I'm betting that this has already been fixed.. I might give it another try today.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
