Re: Regexp Ruby selection
- From: Sebastian Hungerecker <sepp2k@xxxxxxxxxxxxxx>
- Date: Fri, 25 Jul 2008 02:58:39 -0500
touffik@xxxxxxxxx wrote:
I thought the .. between 2 "line =~" was like (...) in rubular which
let catch the content ??
Generally in ruby .. denotes a range. Like starting_value .. end_value.
In this case though it denotes a flip flop, which is evil and should never
ever be used because it makes my head hurt. Here's what it does though:
some_loop {
do_something if foo .. bar
}
This will do nothing until foo is true. When foo is true it will do_something.
It will then keep doing_something in every iteration of the loop until bar
becomes true. After bar became true it will stop doing_something until foo is
true again.
So as a summary: It doesn't do what you thought it did. As a matter of fact it
doesn't do anything sane. So just keep as far away from it as possible.
HTH,
Sebastian
--
Jabber: sepp2k@xxxxxxxxxx
ICQ: 205544826
.
- Follow-Ups:
- Re: Regexp Ruby selection
- From: touffik@xxxxxxxxx
- Re: Regexp Ruby selection
- References:
- Regexp Ruby selection
- From: touffik@xxxxxxxxx
- Regexp Ruby selection
- Prev by Date: Re: Regexp Ruby selection
- Next by Date: Re: how to disable ctrl + c key in ruby on rails
- Previous by thread: Re: Regexp Ruby selection
- Next by thread: Re: Regexp Ruby selection
- Index(es):
Relevant Pages
|