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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E98c7d5fdab0b9ef711956a82ad0eaf1?d=identicon&s=25 Meghana K. (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!
3b63756f70ec36eb5d38cd855e5fb8e7?d=identicon&s=25 Arlen C. (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
E98c7d5fdab0b9ef711956a82ad0eaf1?d=identicon&s=25 Meghana K. (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
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
E98c7d5fdab0b9ef711956a82ad0eaf1?d=identicon&s=25 Meghana K. (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
This topic is locked and can not be replied to.