Class: Chef::Util::DSC::ResourceStore

Inherits:
Object
  • Object
show all
Includes:
Mixin::PowershellExec
Defined in:
lib/chef/util/dsc/resource_store.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



28
29
30
31
32
# File 'lib/chef/util/dsc/resource_store.rb', line 28

def self.instance
  @@instance ||= ResourceStore.new.tap do |store|
    store.send(:populate_cache)
  end
end

Instance Method Details

#find(name, module_name = nil) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chef/util/dsc/resource_store.rb', line 38

def find(name, module_name = nil)
  found = find_resources(name, module_name, resources)

  # We don't have it, query for the resource...it might
  # have been added since we last queried
  if found.length == 0
    rs = query_resource(name)
    add_resources(rs)
    found = find_resources(name, module_name, rs)
  end

  found
end

#resourcesObject



34
35
36
# File 'lib/chef/util/dsc/resource_store.rb', line 34

def resources
  @resources ||= []
end