Inheriting yaml attributes

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édicale
Hôpitaux Universitaires de Genève
Alexander.J.Lamb@sim.hcuge.ch
+41 22 372 88 62
+41 79 420 79 73

Alexander Lamb schrieb:

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