Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #4173
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.mb-net.net!open-news-network.org!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail |
|---|---|
| From | 7stud -- <bbxx789_05ss@yahoo.com> |
| Newsgroups | comp.lang.ruby |
| Subject | Re: Must be my bug, but it looks like Ruby's could it be? |
| Date | Mon, 9 May 2011 14:54:56 -0500 |
| Organization | Service de news de lacave.net |
| Lines | 72 |
| Message-ID | <ced03eb75b4bd36dbbe1998c3e7e96ed@ruby-forum.com> (permalink) |
| References | <35a326a2-4c63-430b-b4b8-8aa7e15873d2@l18g2000yql.googlegroups.com> <43ecaf91e8d0892d69f43684ff203e27@ruby-forum.com> <74404752-d55c-450e-ba7d-a6c93c8a4159@u26g2000vby.googlegroups.com> |
| NNTP-Posting-Host | bristol.highgroove.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | talisker.lacave.net 1304970917 23366 65.111.164.187 (9 May 2011 19:55:17 GMT) |
| X-Complaints-To | abuse@lacave.net |
| NNTP-Posting-Date | Mon, 9 May 2011 19:55:17 +0000 (UTC) |
| In-Reply-To | <74404752-d55c-450e-ba7d-a6c93c8a4159@u26g2000vby.googlegroups.com> |
| X-Received-From | This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway |
| X-Mail-Count | 382883 |
| X-Ml-Name | ruby-talk |
| X-Rubymirror | Yes |
| X-Ruby-Talk | <ced03eb75b4bd36dbbe1998c3e7e96ed@ruby-forum.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.ruby:4173 |
Show key headers only | View raw
RichardOnRails wrote in post #997471: > On Apr 30, 6:06pm, 7stud -- <bbxx789_0...@yahoo.com> wrote: >> > two hashes in this case, which represents the two pseudo-hashes in the >> >> lol. You are using the % shortcut for %Q and you are using [] as the >> delimiter. I have only one thing to say: horrible code writing. >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > Hi 7Stud, > > Thanks for your response. As I mentioned to Mike, I had more serious > things to work on last > week; hence, my belated response. > >>> puts %[%d\t%s => %s] % [num+=1, key, value] > vs. >> puts "%d\t%s => %s" % [num+=1, key, val] > > I used %[...] instead of "..." because I often want to include > embedded double-quotes in my strings > I'm not sure which 'strings' you are talking about? key? val? In that case, it doesn't matter what is inside key or val: key = 'He said, "Hi".' result = "%s" % key puts result --output:-- He said, "Hi". Note that the substitution is not equivalent to writing: result = "He said, "Hi"." ..which will not parse correctly. If you are talking about the string on the left, then you need to alter your quoting regimen depending on the specific situation--do not use a one size fits all approach. That will just make your code hard to decipher. And after trying to decipher your code, I would suggest that NOBODY ever use the % shortcut--either use %q or %Q. Code clarity is much more important than saving one character while typing. and believe my delimiting > approach is clearer since I don't have to escape double-quotes. > Nevertheless, I'm mindful of the ancient adage, de gustibus non est > disputandum. > > As I also mentioned to Mike, I now realize that my parsing routine > produced errors in in my control data. Rather than trying to correct > my amateurish code, I'm going to study one of Ruby Design Patterns > for application to this problems. > > Best wishes, > Richard -- Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Must be my bug, but it looks like Ruby's ... could it be? RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-04-29 21:24 -0700
Re: Must be my bug, but it looks like Ruby's could it be? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-30 17:06 -0500
Re: Must be my bug, but it looks like Ruby's could it be? RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-08 20:33 -0700
Re: Must be my bug, but it looks like Ruby's could it be? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-09 14:54 -0500
Re: Must be my bug, but it looks like Ruby's could it be? RichardOnRails <RichardDummyMailbox58407@USComputerGurus.com> - 2011-05-11 10:37 -0700
csiph-web