class Puppet::ConfineCollection
Attributes
label[R]
Public Class Methods
new(label)
click to toggle source
# File lib/puppet/confine_collection.rb 28 def initialize(label) 29 @label = label 30 @confines = [] 31 end
Public Instance Methods
confine(hash)
click to toggle source
# File lib/puppet/confine_collection.rb 6 def confine(hash) 7 if hash.include?(:for_binary) 8 for_binary = true 9 hash.delete(:for_binary) 10 else 11 for_binary = false 12 end 13 hash.each do |test, values| 14 klass = Puppet::Confine.test(test) 15 if klass 16 @confines << klass.new(values) 17 @confines[-1].for_binary = true if for_binary 18 else 19 confine = Puppet::Confine.test(:variable).new(values) 20 confine.name = test 21 @confines << confine 22 end 23 @confines[-1].label = self.label 24 end 25 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 35 def summary 36 confines = Hash.new { |hash, key| hash[key] = [] } 37 @confines.each { |confine| confines[confine.class] << confine } 38 result = {} 39 confines.each do |klass, list| 40 value = klass.summarize(list) 41 next if (value.respond_to?(:length) and value.length == 0) or (value == 0) 42 result[klass.name] = value 43 44 end 45 result 46 end
valid?()
click to toggle source
# File lib/puppet/confine_collection.rb 48 def valid? 49 ! @confines.detect { |c| ! c.valid? } 50 end