Class: ChefCLI::Generator::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-cli/generator.rb

Overview

This is here to hold attr_accessor data for Generator context variables

Class Method Summary collapse

Class Method Details

.add_attr(name) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/chef-cli/generator.rb', line 24

def self.add_attr(name)
  @attributes ||= [ ]

  unless @attributes.include?(name)
    @attributes << name
    attr_accessor(name)
  end
end

.resetObject



33
34
35
36
37
38
39
40
41
# File 'lib/chef-cli/generator.rb', line 33

def self.reset
  return if @attributes.nil?

  @attributes.each do |attr|
    remove_method(attr)
  end

  @attributes = nil
end