For Programmers: Free Programming Magazines  


Home > Archive > Ruby > August 2005 > Re: ruby way for piece of code









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: ruby way for piece of code
Jim Menard

2005-08-28, 6:59 pm

On 8/24/05, Alexandru Popescu <the.mindstorm.mailinglist@gmail.com> wrote:
> #: Jim Menard changed the world a bit at a time by saying on 8/24/2005 7=

:41 PM :#
#{tag}]]" }[color=darkred]
>=20
> Nice but it misses the case where one of the tags where already changed.


Aah, alreadh changed on any previous line. Got it.

done =3D [] # at the beginning, before any lines processed

new_content << 'tag:'
tags =3D line.split[1..-1]..each { | tag |
unless done.include?(tag)
new_content << " [[#{tag} =3D> #{tag}]]"
done << tag
end
}

Jim
--=20
Jim Menard, jim.menard@gmail.com, jimm@io.com
http://www.io.com/~jimm


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com