------ art_3510_18105159.1131852481908 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Interesting... Thanks! On 11/12/05, Ara.T.Howard <ara.t.howard / noaa.gov> wrote: > > On Sun, 13 Nov 2005, Christian Leskowsky wrote: > > > Hey guys, > > > > I'm very new to ruby. > > > > This is some freaky shite! Could somebody give me a use case as to when > I'd > > want to do something like this? > > > > Thanks! > > > harp:~ > cat a.rb > module Connection > class << self > def host arg = nil > @host = arg if arg > @host > end > def port arg = nil > @port = arg if arg > @port > end > def configure &block > instance_eval &block > end > end > end > > Connection::configure do > host 'http://codeforpeople.com' > port 80 > end > > p Connection::host > p Connection::port > > > harp:~ > ruby a.rb > "http://codeforpeople.com" > 80 > > > regards. > > -a > -- > > =============================================================================== > | ara [dot] t [dot] howard [at] gmail [dot] com > | all happiness comes from the desire for others to be happy. all misery > | comes from the desire for oneself to be happy. > | -- bodhicaryavatara > > =============================================================================== > > > -- - 'There was an owl lived in an oak. The more he heard, the less he spoke. The less he spoke, the more he heard.' Christian Leskowsky christian.leskowsky / gmail.com ------ art_3510_18105159.1131852481908--