From: Chris Carter Date: 2007-01-28T05:59:35+09:00 Subject: Re: Another Ruby language question On 1/26/07, Neville Franks wrote: > Following from yesterday I have a few more Ruby questions. > > Can someone please explain what 'self' does in the following: > > module Mod1 > def self.a_method > puts 'a' > end > > def b_method > puts 'b' > end > end > > If self isn't specificed I'm unable to call the method. ex. > Mod1::b_method fails. > > I've scoured on-line docs about module and come up empty. I see people already helped you with this one > Next. What does '/upload' mean in: > class Upload < R '/upload' This is the beginning of a controller definition in the Camping microframework. The class is "inheriting" from the method R() which takes a regex argument of the route to bind to. The R() method then adds some meta-info to the runtime, and returns an anonymous class that Upload actually inherits from. > This is from: > http://www.oreillynet.com/ruby/blog/2007/01/the_joy_of_rolling_your_own_wi.html > > Thanks. > > --- > Neville Franks, http://www.getsoft.com http://www.surfulater.com > > -- > Posted via http://www.ruby-forum.com/. > > -- Chris Carter concentrationstudios.com brynmawrcs.com