Class: Chef::Cache
- Includes:
- Mixin::ConvertToClassName, Singleton
- Defined in:
- lib/chef/cache.rb,
lib/chef/cache/checksum.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Checksum
Instance Attribute Summary collapse
-
#moneta ⇒ Object
readonly
Returns the value of attribute moneta.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Cache
constructor
A new instance of Cache.
- #reset!(backend = nil, options = nil) ⇒ Object
Methods included from Mixin::ConvertToClassName
#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string
Constructor Details
#initialize(*args) ⇒ Cache
Returns a new instance of Cache.
34 35 36 |
# File 'lib/chef/cache.rb', line 34 def initialize(*args) self.reset!(*args) end |
Instance Attribute Details
#moneta ⇒ Object (readonly)
Returns the value of attribute moneta.
32 33 34 |
# File 'lib/chef/cache.rb', line 32 def moneta @moneta end |
Instance Method Details
#reset!(backend = nil, options = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/chef/cache.rb', line 38 def reset!(backend=nil, =nil) backend ||= Chef::Config[:cache_type] ||= Chef::Config[:cache_options] begin require "moneta/#{convert_to_snake_case(backend, 'Moneta')}" rescue LoadError => e Chef::Log.fatal("Could not load Moneta back end #{backend.inspect}") raise e end @moneta = Moneta.const_get(backend).new() end |