Mailinglist Archive: opensuse-ruby (15 mails)

< Previous Next >
Re: [opensuse-ruby] HelpNeeded: ActiveResource and transitive inheritance
  • From: "Duncan Mac-Vicar Prett" <dmacvicar@xxxxxxx>
  • Date: Mon, 21 Dec 2009 16:33:43 +0100
  • Message-id: <200912211633.44052.dmacvicar@xxxxxxx>
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

--
Duncan Mac-Vicar P. - Engineering Manager, YaST
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)

--
To unsubscribe, e-mail: opensuse-ruby+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-ruby+help@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups