From: "Hal E. Fulton" Date: 2002-04-30T14:49:27+09:00 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