> Can anyone tell me what I'm doing wrong?
>
> Thanks.

Besides what others have pointed out, getAttributes is member function
that should not be used.
This is a bad practice, likely carried over from more limiting
languages such as Java, C++ or Python.

You should use:

class Control
        attr_reader :attributes

        def initialize(x, y, w, h)
                @attributes = {
                        'x'=>x,
                        'y'=>y,
                        'h'=>w,
                        'w'=>h
                }
        end
end

a = Control.new
attrs = a.attributes

If you do require attributes() to do something special in this or
derived class, you can just redefine it.

class DerivedControl < Control
      def attributes
           nil
      end
end

The benefit of this approach is that your interface never changes,
regardless of whether the function is a getter/setter or a true
function that performs some more complex magic.


If, on the other hand, you do require a special member function for a
different operation other than a getter/setter, you should stick to
the ruby convention of lowercase and underscores.  Thus, instead of
calculateAttributes(), you'd use calculate_attributes().