Inheriting yaml attributes

A

Alexander Lamb

--Apple-Mail-6--1067034654
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=ISO-8859-1;
format=flowed

Sorry for the stupid question but why doesn't this work:

def to_yaml_properties
return (super.to_yaml_properties + %w{ @url })
end

I am in a subclass of a class where I have:

def to_yaml_properties
%w{ @abbr @descr }
end

Obviously, I want the result to be an array with @abbr, @descr, @url

But when I print the result:

ping.to_yaml_properties.each { |prop| puts "-- " + prop.to_s}

I get only @url

Something obvious must be wrong here!?!
--
Alexander Lamb
Service d'Informatique M=E9dicale
H=F4pitaux Universitaires de Gen=E8ve
(e-mail address removed)
+41 22 372 88 62
+41 79 420 79 73






--Apple-Mail-6--1067034654--
 
P

Pit Capitain

Alexander said:
Sorry for the stupid question but why doesn't this work:

def to_yaml_properties
return (super.to_yaml_properties + %w{ @url })

return (super + %w{ @url })
end

I am in a subclass of a class where I have:

def to_yaml_properties
%w{ @abbr @descr }
end

Obviously, I want the result to be an array with @abbr, @descr, @url

But when I print the result:

ping.to_yaml_properties.each { |prop| puts "-- " + prop.to_s}

I get only @url

Something obvious must be wrong here!?!

"super" calls the overridden method in the superclass. This is different
from Java, for example.

Regards,
Pit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top