Am 15 Nov 2007 um 21:58 hat Nobuyoshi Nakada geschrieben:

> Iconv::iconv and Iconv#iconv refer same instance method.  

Definitely not!

> You seem to be just confused by the notation.

Definitely not me!

Iconv#iconv means the INSTANCE method iconv of the Iconv class and 
both notations Iconv::iconv AND(!) Iconv.iconv stand for the CLASS 
method iconv of class Iconv. Please have look at the ri output at the 
end or the preface chapter of the pickaxe if you are still confused.

Not I, but you made a mistake about the notation and you did not even 
bother to think about what I really said in this mail. 

> > But instead:
> > 
> > require 'iconv'
> > text = 'Ein ß«fchen im •ÔbergepÁńk,\nda°¨ sieht dir Á…nlich!'
> > tr = Iconv.new('UTF-8', 'l1')
> > puts tr.iconv(text).class       #=> String (NOT Array!)
> 
> You call Iconv#iconv, which always returns a String.

I know, that is what I wrote! 
But it is NOT what the dokumentation says, which I even copied. Do you 
think I invented the ri output in my mail?
And it is extremely inconsistent when the CLASS METHOD Iconv.iconv 
returns an array, while the INSTANCE METHOD Iconv#iconv returns a 
string.

So documentation and consistent logic lead to the expected result: an 
array, while against documentation and logic Iconv#iconv returns a 
srtring!

That is the problem.

class methods:
    Iconv.conv   => String  (=Array.join)
    Iconv.iconv  => Array
instance method:
    Iconv#iconv   => String (!) 

Here the complete ri output (for you with . and ::), which states 
differently:

C:\Dokumente und Einstellungen\Dirk>ri Iconv.iconv
More than one method matched your request. You can refine
your search by asking for information on one of:

     Iconv::iconv, Iconv#iconv


C:\Dokumente und Einstellungen\Dirk>ri Iconv::iconv
----------------------------------------------------------- 
Iconv::iconv
      Iconv.iconv(to, from, *strs)
------------------------------------------------------------------------

     Shorthand for

       Iconv.open(to, from) { |cd|
         (strs + [nil]).collect { |s| cd.iconv(s) }
       }

     Parameters
     <tt>to, from</tt>: see Iconv.new

     <tt>strs</tt>:     strings to be converted

     Exceptions
     Exceptions thrown by Iconv.new, Iconv.open and Iconv#iconv.



C:\Dokumente und Einstellungen\Dirk>ri Iconv#iconv
------------------------------------------------------------ 
Iconv#iconv
      Iconv.iconv(to, from, *strs)
------------------------------------------------------------------------

     Shorthand for

       Iconv.open(to, from) { |cd|
         (strs + [nil]).collect { |s| cd.iconv(s) }
       }

     Parameters
     <tt>to, from</tt>: see Iconv.new

     <tt>strs</tt>:     strings to be converted

     Exceptions
     Exceptions thrown by Iconv.new, Iconv.open and Iconv#iconv.



C:\Dokumente und Einstellungen\Dirk>