class Poise::Subcontext::ResourceCollection
A subclass of the normal Chef ResourceCollection
that creates a partially isolated set of resources. Notifications and other resources lookups can propagate out to parent contexts but not back in. This is used to allow black-box resources that are still aware of things in upper contexts.
@api private @since 1.0.0
Attributes
parent[RW]
Public Class Methods
new(parent)
click to toggle source
Calls superclass method
# File lib/poise/subcontext/resource_collection.rb, line 32 def initialize(parent) @parent = parent super() end
Public Instance Methods
lookup(resource)
click to toggle source
Calls superclass method
# File lib/poise/subcontext/resource_collection.rb, line 37 def lookup(resource) super rescue Chef::Exceptions::ResourceNotFound @parent.lookup(resource) end
recursive_each(&block)
click to toggle source
Iterate over all resources, expanding parent context in order.
@param block [Proc] Iteration block @return [void]
# File lib/poise/subcontext/resource_collection.rb, line 47 def recursive_each(&block) if @parent if @parent.respond_to?(:recursive_each) @parent.recursive_each(&block) else @parent.each(&block) end end each(&block) end
reverse_recursive_each(&block)
click to toggle source
Iterate over all resources in reverse order.
@since 2.3.0 @param block [Proc] Iteration block @return [void]
# File lib/poise/subcontext/resource_collection.rb, line 63 def reverse_recursive_each(&block) reverse_each(&block) if @parent if @parent.respond_to?(:recursive_each) @parent.reverse_recursive_each(&block) else @parent.reverse_each(&block) end end end