On Mar 6, 2011, at 4:55 PM, 7stud -- wrote:

> Joey Zhou wrote in post #985705:
>> ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
>>=20
>> irb(main):001:0> ARGF.class
>> =3D> ARGF.class
>>=20
>> What does "ARGF.class" mean? Isn't ARGF a special IO object, whose =
class
>> is "IO", just like STDIN?
>>=20
>> irb(main):002:0> STDIN.class
>> =3D> IO
>=20
> First note that your output is not ARGFCLASS.  You really are getting =
no=20
> output--if what you posted is correct; irb just output what you typed=20=

> in.

This is not a correct interpretation of the 1.9.2 output.

ARGF is an instance of a class and the class has the name 'ARGF.class'.
That is a very unusual class name which makes it a bit difficult to
interpret the IRB output.

IRB prints the result of calling #inspect on the last expression entered =
and
for a class that is just the name of the class:

ruby-1.9.2-p0 > ARGF.class
 =3D> ARGF.class=20
ruby-1.9.2-p0 > a =3D ARGF.class; 1
 =3D> 1=20
ruby-1.9.2-p0 > a.inspect
 =3D> "ARGF.class"=20
ruby-1.9.2-p0 > a.class
 =3D> Class=20
ruby-1.9.2-p0 > a.name
 =3D> "ARGF.class"=20
ruby-1.9.2-p0 >   ARGF.class.superclass
 =3D> Object=20
ruby-1.9.2-p0 >=20

So ARGF is an instance of a class named 'ARGF.class' and that class is
just a subclass of Object.  ARGF does respond to many of the same =
methods
that an instance of IO would respond to but that is just an example
of duck typing rather than inheritance.

ruby-1.9.2-p0 > (ARGF.class.instance_methods(false) & =
IO.instance_methods(false))
 =3D> [:fileno, :to_i, :to_io, :each, :each_line, :each_byte, =
:each_char, :lines, :bytes, :chars, :read, :readpartial, :readlines, =
:gets, :readline, :getc, :getbyte, :readchar, :readbyte, :tell, :seek, =
:rewind, :pos, :pos=3D, :eof, :eof?, :binmode, :binmode?, :close, =
:closed?, :lineno, :lineno=3D, :external_encoding, :internal_encoding, =
:set_encoding]=20
ruby-1.9.2-p0 > ARGF.class.included_modules
 =3D> [Enumerable, Kernel]=20


Gary Wright