[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. 2.6.3-345-g919f443

Markus Roberts Markus at reality.com
Wed Nov 17 18:21:04 UTC 2010


The following commit has been merged in the master branch:
commit 1ce00dccb840abd9e11432d00c73bdd1de104751
Author: Markus Roberts <Markus at reality.com>
Date:   Mon Nov 15 18:49:53 2010 -0800

    Step towards [5298] -- cleanup indentation, etc. in AST::Collection
    
    My code smell routines bobbled this one, so I'm fixing it manually.

diff --git a/lib/puppet/parser/ast/collection.rb b/lib/puppet/parser/ast/collection.rb
index 09d5b4e..90a9143 100644
--- a/lib/puppet/parser/ast/collection.rb
+++ b/lib/puppet/parser/ast/collection.rb
@@ -5,61 +5,43 @@ require 'puppet/parser/collector'
 # An object that collects stored objects from the central cache and returns
 # them to the current host, yo.
 class Puppet::Parser::AST
-class Collection < AST::Branch
-  attr_accessor :type, :query, :form
-  attr_reader :override
-
-  associates_doc
-
-  # We return an object that does a late-binding evaluation.
-  def evaluate(scope)
-    if self.query
-      str, code = self.query.safeevaluate scope
-    else
-      str = code = nil
-    end
-
-    newcoll = Puppet::Parser::Collector.new(scope, @type, str, code, self.form)
-
-    scope.compiler.add_collection(newcoll)
-
-    # overrides if any
-    # Evaluate all of the specified params.
-    if @override
-      params = @override.collect do |param|
-        param.safeevaluate(scope)
+  class Collection < AST::Branch
+    attr_accessor :type, :query, :form
+    attr_reader :override
+
+    associates_doc
+
+    # We return an object that does a late-binding evaluation.
+    def evaluate(scope)
+      str, code = query && query.safeevaluate(scope)
+
+      newcoll = Puppet::Parser::Collector.new(scope, @type, str, code, self.form)
+
+      scope.compiler.add_collection(newcoll)
+
+      # overrides if any
+      # Evaluate all of the specified params.
+      if @override
+        params = @override.collect { |param| param.safeevaluate(scope) }
+        newcoll.add_override(
+          :parameters => params,
+          :file => @file,
+          :line => @line,
+          :source => scope.source,        
+          :scope => scope
+        )
       end
 
-
-            newcoll.add_override(
-                
-        :parameters => params,
-        :file => @file,
-        :line => @line,
-        :source => scope.source,
-        
-        :scope => scope
-      )
+      newcoll
     end
 
-    newcoll
-  end
-
-  # Handle our parameter ourselves
-  def override=(override)
-    if override.is_a?(AST::ASTArray)
-      @override = override
-    else
-
-            @override = AST::ASTArray.new(
-                
-        :line => override.line,
-        :file => override.file,
-        
-        :children => [override]
-      )
+    # Handle our parameter ourselves
+    def override=(override)
+      @override = if override.is_a?(AST::ASTArray)
+        override
+      else
+        AST::ASTArray.new(:line => override.line,:file => override.file,:children => [override])
+      end
     end
   end
-
-end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list