Project

General

Profile

Bug #4484

Class variables leak to Object when using class_eval

Added by pawel (PaweĊ‚ P) about 8 years ago. Updated about 8 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
[ruby-core:<unknown>]

Description

=begin
The following irb session describes the problem:

String.class_eval { @@string_class_variable = 'should be only in String' }
=> "should be only in String"
"WTF?" if Object.class_variables.include? "@@string_class_variable"
=> "WTF?"

Tested on 1.8 and 1.9.
I've created the issue in "ruby-18" project because "ruby" project doesn't allow to create new issues.
=end

Also available in: Atom PDF