On Dec 1, 2010, at 6:39 AM, Peter Meier wrote: > Why do another assignment and loop, when we can use a simple > compact? > > Signed-off-by: Peter Meier <[email protected]> > --- > lib/puppet/parser/ast/astarray.rb | 5 +---- > 1 files changed, 1 insertions(+), 4 deletions(-) > > diff --git a/lib/puppet/parser/ast/astarray.rb > b/lib/puppet/parser/ast/astarray.rb > index 529998e..669a78d 100644 > --- a/lib/puppet/parser/ast/astarray.rb > +++ b/lib/puppet/parser/ast/astarray.rb > @@ -31,10 +31,7 @@ class Puppet::Parser::AST > end > } > > - rets = items.flatten.collect { |child| > - child.safeevaluate(scope) > - } > - rets.reject { |o| o.nil? } > + items.flatten.collect { |child| child.safeevaluate(scope) }.compact
This isn't the same behavior, is it? This will only ever result in a single flat array, whereas we previously could have returned arrays of arrays, right? -- To have a right to do a thing is not at all the same as to be right in doing it. -- G. K. Chesterton --------------------------------------------------------------------- Luke Kanies -|- http://puppetlabs.com -|- +1(615)594-8199 -- 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.
