~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to lib/puppet/parser/ast/astarray.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-25 01:00:37 UTC
  • mfrom: (1.1.24 upstream) (3.1.25 sid)
  • Revision ID: james.westby@ubuntu.com-20110725010037-875vuxs10eboqgw3
Tags: 2.7.1-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/puppetmaster-passenger.postinst: Use cacrl instead of hostcrl to
    set the location of the CRL in apache2 configuration. Fix apache2
    configuration on upgrade as well (LP: #641001)
  - move all puppet dependencies to puppet-common since all the code
    actually located in puppet-common.
  - move libagueas from a recommend to a dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
    # Evaluate our children.
18
18
    def evaluate(scope)
19
 
      # Make a new array, so we don't have to deal with the details of
20
 
      # flattening and such
21
 
      items = []
22
 
 
23
 
      # First clean out any AST::ASTArrays
24
 
      @children.each { |child|
25
 
        if child.instance_of?(AST::ASTArray)
26
 
          child.each do |ac|
27
 
            items << ac
 
19
      result = []
 
20
      @children.each do |child|
 
21
        # Skip things that respond to :instantiate (classes, nodes,
 
22
        # and definitions), because they have already been
 
23
        # instantiated.
 
24
        if !child.respond_to?(:instantiate)
 
25
          item = child.safeevaluate(scope)
 
26
          if !item.nil?
 
27
            # nil values are implicitly removed.
 
28
            result.push(item)
28
29
          end
29
 
        else
30
 
          items << child
31
30
        end
32
 
      }
33
 
 
34
 
      rets = items.flatten.collect { |child|
35
 
        child.safeevaluate(scope)
36
 
      }
37
 
      rets.reject { |o| o.nil? }
 
31
      end
 
32
      result
38
33
    end
39
34
 
40
35
    def push(*ary)
52
47
      "[" + @children.collect { |c| c.to_s }.join(', ') + "]"
53
48
    end
54
49
  end
55
 
 
56
 
  # A simple container class, containing the parameters for an object.
57
 
  # Used for abstracting the grammar declarations.  Basically unnecessary
58
 
  # except that I kept finding bugs because I had too many arrays that
59
 
  # meant completely different things.
60
 
  class ResourceInstance < ASTArray; end
61
50
end