J
John W. Long
class MyModule; end
=> nil
from (irb):8
What in the world is going on here? Why does the block syntax eval
differently than the string syntax? And why does @@test get defined on
both MyModule and Object?
=> nil
NameError: uninitialized class variable @@weird in ObjectMyModule.class_variables => []
MyModule.module_eval do ?> @@test = true
end => true
@@test => true
MyModule.module_eval "@@weird = true" => true
@@weird
from (irb):8
=> ["@@test"]MyModule.class_variables => ["@@weird", "@@test"]
Object.class_variables
What in the world is going on here? Why does the block syntax eval
differently than the string syntax? And why does @@test get defined on
both MyModule and Object?