Forum: Ruby NoMethodError raised for using 'raise' in code.

Posted by Meghana Kop (meghanak)
on 2012-12-19 02:55
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 method `raise' for
#<StudentEntryForm:0x000000022c5cc0> (NoMethodError)


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

Thanks!
Posted by Arlen Cuss (unnali)
on 2012-12-19 05:28
(Received via mailing list)
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
Posted by Meghana Kop (meghanak)
on 2012-12-19 20:07
Attachment: EntryForm.rb (499 Bytes)
Attachment: StudentEntryForm.rb (538 Bytes)
Attachment: tester.rb (263 Bytes)
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! :)

Arlen Cuss 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
Posted by Sam Duncan (Guest)
on 2012-12-19 20:33
(Received via mailing list)
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/StudentE...
> 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
Posted by Meghana Kop (meghanak)
on 2012-12-19 20:56
Hi Sam,

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

-
Meghana

Sam Duncan 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/StudentE...
>> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.