On Apr 8, 10:32 pm, klochner <[email protected]> wrote: > The first part of my question is whether there is a way to pass in a > reference to the calling class (klass) without first setting it as a > variable. My understand is that if I used self directly in the > class_eval statement, it would evaluate to Rclient.
Maybe, don't know off hand. > The second part of my questions is why I had to use define_method for > primary_client= (as opposed to def primary_client=). I kept getting > conflicts with the dynamic methods rails created from the statement I *think* the def method is scoping it inside the proc whereas define_method is actually evaluating it within the context of the class_eval (and therefore getting defined as an instance method of the class). I highly recommend the O'Reilly book, The Ruby Programming Language since it gives details about metaprogramming that's rarely found elsewhere and organized in the same place. There are stuff about how to access the variable bindings and may answer your first question as well. Ho-Sheng Hsiao http://hosheng.blogspot.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

