On Dec 2, 2010, at 6:27 PM, Tony Arcieri wrote:

> On Thu, Dec 2, 2010 at 4:18 PM, Intransition <transfire / gmail.com> wrote:
> 
>> http://www.hokstad.com/ruby-object-model.html
>> 
> 
> That seems to refer to it as a "Class object"... my question is why does the
> Class object seem to have singleton methods?

Because some classes have behavior that is unique to the class.
File and Time are both objects which are instances of Class but
they respond to a different set of methods. For example:

	File.exists? is a class method.
	Time.now is a class method.

For an object to have per-object methods, the methods are defined
in the object's singleton class:

ruby-1.9.2-p0 > Time.singleton_class.instance_methods(false)
 => [:now, :at, :utc, :gm, :local, :mktime, :_load] 
ruby-1.9.2-p0 > File.singleton_class.instance_methods(false)

 => [:directory?, :exist?, :exists?, :readable?, :readable_real?, :world_readable?, :writable?, :writable_real?, :world_writable?, :executable?, :executable_real?, :file?, :zero?, :size?, :size, :owned?, :grpowned?, :pipe?, :symlink?, :socket?, :blockdev?, :chardev?, :setuid?, :setgid?, :sticky?, :identical?, :stat, :lstat, :ftype, :atime, :mtime, :ctime, :utime, :chmod, :chown, :lchmod, :lchown, :link, :symlink, :readlink, :unlink, :delete, :rename, :umask, :truncate, :expand_path, :absolute_path, :realpath, :realdirpath, :basename, :dirname, :extname, :path, :split, :join, :fnmatch, :fnmatch?]