NoMethodError raised for using 'raise' in code

I have a superclass called EntryForm. All sub-classes of this class need
to implement a function called draw(). To ensure that it is done so, I
declared it in the superclass and raise an error when a call is made to
the superclass’s implementation of the fn instead of being implemented
in the sub-class.

However, when I tried to instantiate the sub-class StudentEntryForm(I
have not implemented draw() in Student… and expect NotImplementedError
to be raised.), I get the following error:
lib/Qt/qtruby4.rb:2401:in method_missing': undefined methodraise’ for
#StudentEntryForm:0x000000022c5cc0 (NoMethodError)

def draw()
raise NotImplementedError, ‘You must implement draw() in all of
EntryForm’s sub-classes’
end

Thanks!

Hi Meghana,

I definitely can’t reproduce this. Is there any more relevant code you
can
produce, or even a self-contained example that shows this bug? I can
only
imagine this happening if you defined something called raise somewhere,
and
even then, it’s hard to work out how it would eventuate …

Cheers,

Arlen

Hi Arlen,

I’ve attached the code I’m using. The error doesn’t come up when I use
Kernel::raise instead of just raise…
I haven’t defined any function called raise anywhere else so I’m not
sure why the error keeps coming up…

Thank you for your time! :slight_smile:

Arlen C. wrote in post #1089532:

Hi Meghana,

I definitely can’t reproduce this. Is there any more relevant code you
can
produce, or even a self-contained example that shows this bug? I can
only
imagine this happening if you defined something called raise somewhere,
and
even then, it’s hard to work out how it would eventuate …

Cheers,

Arlen

Hi Sam,

That just seems to be the case. Thanks a bunch!!

Meghana

Sam D. wrote in post #1089620:

On 12/20/2012 08:07 AM, Meghana Kop wrote:

Hi Meghana,

Arlen
Attachments:
http://www.ruby-forum.com/attachment/7983/EntryForm.rb
http://www.ruby-forum.com/attachment/7984/StudentEntryForm.rb
http://www.ruby-forum.com/attachment/7985/tester.rb

Is Qt::Widget perhaps implementing raise?

http://doc.qt.digia.com/4.7-snapshot/qwidget.html#raise

Sam

On 12/20/2012 08:07 AM, Meghana Kop wrote:

Hi Meghana,

Arlen
Attachments:
http://www.ruby-forum.com/attachment/7983/EntryForm.rb
http://www.ruby-forum.com/attachment/7984/StudentEntryForm.rb
http://www.ruby-forum.com/attachment/7985/tester.rb

Is Qt::Widget perhaps implementing raise?

http://doc.qt.digia.com/4.7-snapshot/qwidget.html#raise

Sam

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs