From: Arlen Christian Mart Cuss Date: 2012-12-19T13:27:54+09:00 Subject: Re: NoMethodError raised for using 'raise' in code. --047d7b6252360c8a0504d12cefd1 Content-Type: text/plain; charset=UTF-8 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 On Wed, Dec 19, 2012 at 12:55 PM, Meghana Kop wrote: > 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 > # (NoMethodError) > > > def draw() > raise NotImplementedError, 'You must implement draw() in all of > EntryForm\'s sub-classes' > end > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > > --047d7b6252360c8a0504d12cefd1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Meghana,

I definitely can't repr= oduce this. =C2=A0Is there any more relevant code you can produce, or even = a self-contained example that shows this bug? =C2=A0I 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,

Arle= n


= On Wed, Dec 19, 2012 at 12:55 PM, Meghana Kop <lists@ruby-forum.com= > wrote:
I have a superclass called EntryForm. All su= b-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<= br> 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)


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

Thanks!

--
Posted via http://= www.ruby-forum.com/.


--047d7b6252360c8a0504d12cefd1--