From: Joel VanderWerf Date: 2001-12-15T16:48:56+09:00 Subject: [ruby-talk:28604] assigning to class variable works in string, not in block In the following code, the first class_eval results in "uninitialized class variable @@base_class in BaseClass (NameError)". But when I use "..." instead of {...}, it works as intended. Why this difference? I'm using Ruby 1.6.5. module M def self.append_features base_class base_class.class_eval {@@base_class = self} # fails # base_class.class_eval "@@base_class = self" # ok end end class BaseClass include M end Note that the following works fine: class BaseClass class_eval {@@base_class = self} end -- Joel VanderWerf California PATH, UC Berkeley mailto:vjoel@path.berkeley.edu Ph. (510) 231-9446 http://www.path.berkeley.edu FAX (510) 231-9512