Module: ChefCLI::Generator

Defined in:
lib/chef-cli/generator.rb

Defined Under Namespace

Modules: TemplateHelper Classes: Context

Class Method Summary collapse

Class Method Details

.add_attr_to_context(name, value = nil) ⇒ Object



52
53
54
55
56
57
# File 'lib/chef-cli/generator.rb', line 52

def self.add_attr_to_context(name, value = nil)
  sym_name = name.to_sym
  ChefCLI::Generator::Context.add_attr(sym_name)
  ChefCLI::Generator::TemplateHelper.delegate_to_app_context(sym_name)
  context.public_send("#{sym_name}=", value)
end

.contextObject



48
49
50
# File 'lib/chef-cli/generator.rb', line 48

def self.context
  @context ||= Context.new
end

.resetObject



44
45
46
# File 'lib/chef-cli/generator.rb', line 44

def self.reset
  @context = nil
end