From: Nat Pryce Date: 2002-04-30T22:12:50+09:00 Subject: Re: An example of the beauty of Ruby... If we're going to nitpick, I'd say that there's too many negatives in one sentence. I'd write: upload if changed Cheers, Nit Pick oops I mean Nat Pryce. ________________________________ Dr. Nathaniel Pryce B13media Ltd. Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA http://www.b13media.com ----- Original Message ----- From: "Rich Kilmer" To: "ruby-talk ML" Sent: Tuesday, April 30, 2002 1:51 PM Subject: RE: An example of the beauty of Ruby... > OK...about as nitpicking as it gets... > > upload unless unchanged? > > Per the standard Rubyism of the question mark for Boolean methods. > > -Rich :) > > > -----Original Message----- > > From: Hal E. Fulton [mailto:hal9000@hypermetrics.com] > > Sent: Tuesday, April 30, 2002 1:49 AM > > To: ruby-talk ML > > Subject: An example of the beauty of Ruby... > > > > Who was it who said something like, "In Ruby, > > my thoughts flow directly into code"? > > > > I ran across this example I thought I'd share. > > > > I've been working on a simple application that > > will download files for editing, invoke an editor, > > and re-upload afterward. > > > > Then I thought to myself: "Hmm. But I don't really > > want to bother uploading the file if it doesn't change." > > > > So I wrote this bit of pseudocode: > > > > upload unless unchanged > > > > (Being a product of the 1980s, I think in pseudocode... > > I have even had to draw [shudder] flowcharts in one > > or two college courses... but don't tell anyone.) > > > > So I thought: "Hmm. I could put all the relevant > > information into instance variables. Then the method > > could access them as needed. Why don't I just call it > > 'upload'? Then put an if-statement around it to handle > > the change check... wait a minute. I could have a method > > called 'unchanged' for that." > > > > So I wrote this line of code: > > > > upload unless unchanged > > > > Deja vu, anyone? > > > > BTW, although this app is still rather clunky, I'll announce > > it soon so that people can suggest improvements, fixes, > > and so on. (I call it RubyRED, for Ruby Remote Editor. > > It's one of those names which, if I didn't use, someone > > else would.) > > > > Cheers, > > Hal Fulton > > > >