> --- > lib/puppet/provider/mailalias/aliases.rb | 13 ++++++++++++- > 1 files changed, 12 insertions(+), 1 deletions(-) > > diff --git a/lib/puppet/provider/mailalias/aliases.rb > b/lib/puppet/provider/mailalias/aliases.rb > index 8b5c456..fa3ef9f 100755 > --- a/lib/puppet/provider/mailalias/aliases.rb > +++ b/lib/puppet/provider/mailalias/aliases.rb > @@ -10,13 +10,24 @@ Puppet::Type.type(:mailalias).provide(:aliases, > > record_line :aliases, :fields => %w{name recipient}, :separator => > /\s*:\s*/, :block_eval => :instance do > def post_parse(record) > - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] > + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
White space damage, you can rebase interactively choose to edit this commit and remove this part as it's just noise. > + 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) Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---