On Mar 29, 7:35 am, "KJF" <Kevin.Fag... / gmail.com> wrote:
...
> Here are my classes and test data
>
> class Control
>         attr :attributes, true
>
>         def initialize(x, y, w, h)
>                 @attributes = {
>                         'x'=>x,
>                         'y'=>y,
>                         'h'=>w,
>                         'w'=>h
>                 }
>         end
>
>         def getAttributes
>                 return @attributes
>         end
> end
>
> class StaticTextControl < Control
>
>         def initialize(x, y, w, h, xBorder, yBorder, fontSize, fontMode,
> phrase)
>                 super(x, y, w, h)
>                 @@desc = 'STATIC_TEXT_CONTROL'
>                 @attributes = {
>                         'xBorder'=>xBorder,
>                         'yBorder'=>yBorder,
>                         'fontSize'=>fontSize,
>                         'fontMode'=>fontMode,
>                         'phrase'=>phrase
>                 }
...
@attributes is an instance attribute, so right here you change it,
loosing the x,y,w,h values.

you should use merge here, and then there is no need to re-implement
getAttributes as the superclass method will work as expected

Cheers
Chris