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 Marco Kotrotsos wrote: > Thank you Ivan, that has been most helpful! > > Marco > > > Ivan Porto carrero wrote: >> A CLR string is not the same as a ruby string. Calling .to_s before >> downcase >> should work or you can monkey patch System::String and add the method >> downcase to the clr string class if it bothers you too much >> >> >> class System::String >> >> def downcase >> self.to_s.downcase >> end >> >> end -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core