From: Paul McKibbin Date: 2010-05-21T08:10:10+09:00 Subject: Re: class arrays On 2010-05-18 15:53:02 +0100, poseid said: > On 18 Mai, 16:00, MrZombie wrote: >> >> Erh, not that way. Sorry. >> >> You could have >> >> class A >> �@b = [1,2,3] >> end >> >> Which stores the array in a class-level instance variable. >> >> This other one >> class A >> �@@b = [1,2,3] >> end >> >> stores the array in a class variable. >> > > > Hm... ok, this is more or less what I expected as well, when reading > code employing instance/class variables. But how do I understand the > (old) code from a book on Rails: > > class T < ActionView::Helpers::FormBuilder > field_helpers.each do |s| > src = <<-END_SRC > def #{s}(field, options = {}) > @template.content_tag( ... ) > end > END_SRC > class_eval src, __FILE__, __LINE__ > end > end > > To me it seems that field_helpers is an instance variable, but there > is no @ nor @@ used > > thanks for feedback I'm not familiar with the old actionview methods, but it strikes me that the most likely reason is that field_helpers is a class method that returns an array of strings. Sort of like def self.field_helpers %w(list of desired words) end or something to that effect. You could check that by grepping the methods that T has. Mac