On 2009-12-21 16:33:43 +0100, Duncan Mac-Vicar Prett wrote:
Date: Mon, 21 Dec 2009 16:33:43 +0100 From: Duncan Mac-Vicar Prett <dmacvicar@suse.de> Subject: Re: [opensuse-ruby] HelpNeeded: ActiveResource and transitive inheritance To: opensuse-ruby@opensuse.org Cc: Josef Reidinger <jreidinger@suse.cz>
On Monday 21 December 2009 15:01:09 Josef Reidinger wrote:
from my understanding attr_accessor_with_default sets a instance variable on the class object. those are not inherited.
class TestA class << self def test_a "test_a" end end end
class TestB < TestA end
class TestC class << self attr_accessor_with_default(:test_c) { "test_c" } end end
class TestD < TestC end
class TestF < TestD end
puts TestA.test_a puts TestB.test_a puts TestC.test_c puts TestD.test_c puts TestF.test_c
output: test_a test_a test_c test_c test_c
well i believe you that printing out the default value works, as it should. but setting the value for test_c saves the value in an *instance* variable of the Class object. :) darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-ruby+help@opensuse.org