From: nobu.nokada@... Date: 2004-07-16T06:49:56+09:00 Subject: Re: converting types Hi, At Fri, 16 Jul 2004 06:37:09 +0900, Charles Mills wrote in [ruby-talk:106579]: > For example I want to use a type as an integer only if it has a > "to_int" method or is already a Fixnum or Bignum, otherwise raise an > error. I was hoping to do the same thing using "to_str" for Strings > and "to_ary" for Arrays. The rb_String() function will turn most > objects into Strings (Files for example) and in those cases I want my > code to raise an error. There's StringValue() for String, and rb_convert_type() for generic types. Note that StringValue() requires lvalue as the argument. -- Nobu Nakada