class Puppet::ConfineCollection

Attributes

label[R]

Public Class Methods

new(label) click to toggle source
   # File lib/puppet/confine_collection.rb
29 def initialize(label)
30   @label = label
31   @confines = []
32 end

Public Instance Methods

confine(hash) click to toggle source
   # File lib/puppet/confine_collection.rb
 7 def confine(hash)
 8   if hash.include?(:for_binary)
 9     for_binary = true
10     hash.delete(:for_binary)
11   else
12     for_binary = false
13   end
14   hash.each do |test, values|
15     klass = Puppet::Confine.test(test)
16     if klass
17       @confines << klass.new(values)
18       @confines[-1].for_binary = true if for_binary
19     else
20       confine = Puppet::Confine.test(:variable).new(values)
21       confine.name = test
22       @confines << confine
23     end
24     @confines[-1].label = self.label
25   end
26 end
summary() click to toggle source

Return a hash of the whole confine set, used for the Provider reference.

   # File lib/puppet/confine_collection.rb
36 def summary
37   confines = Hash.new { |hash, key| hash[key] = [] }
38   @confines.each { |confine| confines[confine.class] << confine }
39   result = {}
40   confines.each do |klass, list|
41     value = klass.summarize(list)
42     next if (value.respond_to?(:length) and value.length == 0) or (value == 0)
43     result[klass.name] = value
44 
45   end
46   result
47 end
valid?() click to toggle source
   # File lib/puppet/confine_collection.rb
49 def valid?
50   ! @confines.detect { |c| ! c.valid? }
51 end