And when talking about instance methods one sometimes uses
classname#method name
Since this is what ri understands when you ask for documentation:
$ri to_s
More than one method matched your request. You can refine
your search by asking for information on one of:
Method#to_s, Vector#to_s, Struct#to_s, Time#to_s, CGI::Cookie#to_s,
Array#to_s, Matrix#to_s, MatchData#to_s, FalseClass#to_s,
Pathname#to_s, Pathname#to_str, Rational#to_s, Hash#to_s,
UnboundMethod#to_s, TrueClass#to_s, Module#to_s, Complex#to_s,
Proc#to_s, Symbol#to_s, Symbol#to_sym, Exception#to_s,
Exception#to_str, Bignum#to_s, Object#to_s, NilClass#to_s,
Range#to_s, Date#to_s, NameError#to_s, Fixnum#to_s, Fixnum#to_sym,
Float#to_s, String#to_s, String#to_str, String#to_sym, Regexp#to_s,
Benchmark::Tms#to_s, URI::MailTo#to_s, URI::FTP#to_s,
URI::Generic#to_s, Process::Status#to_s, Enumerable#to_set
$ri Object#to_s
------------------------------------------------------------ Object#to_s
obj.to_s => string
ยทยทยท
On 10/23/06, Jason Roelofs <jameskilton@gmail.com> wrote:
This is just Ruby syntax. It allows both :: and . as operators to
class-level methods and variables.
File::open and File.open are the exact same thing: a class method. Were it
an instance method, you would have to do:
file = File.new
file.open
------------------------------------------------------------------------
Returns a string representing _obj_. The default +to_s+ prints the
object's class and an encoding of the object id. As a special case,
the top-level object that is the initial execution context of Ruby
programs returns ``main.''
And, by the way, the open method in question is really a class method
of IO rather than File, the File class inherits it.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/
Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/