On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]>
wrote:
> If you don't use class << self, you have to work on class variables and
> you can't use the attr_* shorthands to access the singleton's variables.
It's true you need to use class << self to use attr_* macros, but not
true that you can't use singleton instance variables otherwise:
class Foo
class << self
attr_accessor :class_var
end
def self.hello
puts "@class_var: [EMAIL PROTECTED]"
end
end
Foo.class_var = 42
Foo.hello
=> "@class_var: 42"
--
Avdi
Home: http://avdi.org
Developer Blog: http://avdi.org/devblog/
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users