Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Chef::Cookbook::SyntaxCheck::PersistentSet

Chef::Cookbook::SyntaxCheck::PersistentSet

Implements set behavior with disk-based persistence. Objects in the set are expected to be strings containing only characters that are valid in filenames.

This class is used to track which files have been syntax checked so that known good files are not rechecked.

Attributes

cache_path[R]

Public Class Methods

new(cache_path=nil) click to toggle source

Create a new PersistentSet. Values in the set are persisted by creating a file in the cache_path directory. If not given, the value of Chef::Config is used; if that value is not configured, the value of Chef::Config[:path] is used.

# File lib/chef/cookbook/syntax_check.rb, line 52
def initialize(cache_path=nil)
  @cache_path = cache_path || Chef::Config[:syntax_check_cache_path] || Chef::Config[:cache_options][:path]
  @cache_path_created = false
end

Public Instance Methods

add(value) click to toggle source

Adds value to the set's collection.

# File lib/chef/cookbook/syntax_check.rb, line 58
def add(value)
  ensure_cache_path_created
  FileUtils.touch(File.join(cache_path, value))
end
include?(value) click to toggle source

Returns true if the set includes value

# File lib/chef/cookbook/syntax_check.rb, line 64
def include?(value)
  File.exist?(File.join(cache_path, value))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.