Sebastian Hungerecker
7/17/2007 7:44:00 PM
Kaldrenon wrote:
> The error I'm getting is this:
> undefined method `series' for Test:Class (NoMethodError)
> from euler14.rb:14:in `each'
>
> I see no clear reason why I'm getting this error. Can you un-dumb me?
You define series as an instance method, but you try to invoke it as a class
method. If you do
class Bla
def blubb() end
end
x=Bla.new
there will be a x.blubb but no Bla.blubb.
If you want a Bla.blubb you have to define it with "def self.blubb".
Also given the fact that you never create an instance of your class, you don't
actually need to define a class.
--
Ist so, weil ist so
Bleibt so, weil war so