1
# Manage a collection of confines, returning a boolean or
3
require 'puppet/provider/confine'
5
class Puppet::Provider::ConfineCollection
7
if hash.include?(:for_binary)
9
hash.delete(:for_binary)
13
hash.each do |test, values|
14
if klass = Puppet::Provider::Confine.test(test)
15
@confines << klass.new(values)
16
@confines[-1].for_binary = true if for_binary
18
confine = Puppet::Provider::Confine.test(:variable).new(values)
29
# Return a hash of the whole confine set, used for the Provider
32
confines = Hash.new { |hash, key| hash[key] = [] }
33
@confines.each { |confine| confines[confine.class] << confine }
35
confines.each do |klass, list|
36
value = klass.summarize(list)
37
next if (value.respond_to?(:length) and value.length == 0) or (value == 0)
38
result[klass.name] = value
45
! @confines.detect { |c| ! c.valid? }