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]
>> 
>> irb(main):001:0> ARGF.class
>> => ARGF.class
>> 
>> What does "ARGF.class" mean? Isn't ARGF a special IO object, whose class
>> is "IO", just like STDIN?
>> 
>> irb(main):002:0> STDIN.class
>> => IO
> 
> First note that your output is not ARGFCLASS.  You really are getting no 
> output--if what you posted is correct; irb just output what you typed n.

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
 => ARGF.class 
ruby-1.9.2-p0 > a = ARGF.class; 1
 => 1 
ruby-1.9.2-p0 > a.inspect
 => "ARGF.class" 
ruby-1.9.2-p0 > a.class
 => Class 
ruby-1.9.2-p0 > a.name
 => "ARGF.class" 
ruby-1.9.2-p0 >   ARGF.class.superclass
 => Object 
ruby-1.9.2-p0 > 

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))
 => [: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=, :eof, :eof?, :binmode, :binmode?, :close, :closed?, :lineno, :lineno=, :external_encoding, :internal_encoding, :set_encoding] 
ruby-1.9.2-p0 > ARGF.class.included_modules
 => [Enumerable, Kernel] 


Gary Wright