On Thu, Jan 15, 2009 at 10:40 AM, Paul Nasrat <[email protected]> wrote:
> White space damage, you can rebase interactively choose to edit this
> commit and remove this part as it's just noise.

I'll fix this when I fix below:

>> +        def process(line)
>> +          ret = {}
>> +          # Everything up to the first ':' character is the first
>> +          # record (:name).
>> +          ret[:name] = line[/^[^\s:]*/]
>> +          # Everything after the first ':' character (except leading
>> +          # and trailing whitespace) is the second record (:recipient).
>> +          ret[:recipient] = line[(line.index(/\s*:\s*/) + 
>> 1)..line.length].lstrip.rstrip
>> +          ret
>> +        end
>> +
>
> If you're going to use index of and regex's you might as well just do
> with capturing to get what you want rather than using string indexes.
> On the other hand any reason you're not doing a limited split and then
> stripping:
>
> line.split(':', 2)

I just didn't know that would work :-)

Thanks for your comments, I'll resubmit.

--Paul

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to