[Ironruby-core] undefined Method 'downcase'
Curt Hagenlocher
curth at microsoft.com
Thu Mar 19 12:42:55 EDT 2009
Out of curiosity, why are you passing a string to this method through the hosting interface instead of just passing an int? What does the calling code look like?
-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Marco Kotrotsos
Sent: Thursday, March 19, 2009 9:40 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] undefined Method 'downcase'
ugh (slap head)
it was
n = arg.to_s.to_i
so nasty...:)
Marco
Marco Kotrotsos wrote:
> i'm sorry, another one popped up and I hope you can help me with it
>
> it's with this example
>
> class Plotlight
> def fib n
> if n<2
> n
> else
> res = fib(n-2)+fib(n-1)
> end
> end
> end
>
>
> when executing, I get Object must be of type String. I suspect this to
> be because I am feeding it a String argument. When I do this
>
> class Plotlight
> def fib arg
> n = arg.to_i
> if n<2
> n
> else
> res = fib(n-2)+fib(n-1)
> end
> end
> end
>
> it now says
>
> + $exception {"undefined method `to_i' for 12:ClrString"}
> System.Exception {System.MissingMethodException}
>
>
> so it again must be because it's not an expected Integer...but how do I
> work around this one? I am trying to understand how this works.
>
> Thanks
> Marco
>
>
>
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core
More information about the Ironruby-core
mailing list