Adds an attribute )hat a user needs to configure for this cookbook. Takes a
name (with the / notation for a nested attribute), followed by any of these
options
def attribute(name, options)
validate(
options,
{
:display_name => { :kind_of => String },
:description => { :kind_of => String },
:choice => { :kind_of => [ Array ], :default => [] },
:calculated => { :equal_to => [ true, false ], :default => false },
:type => { :equal_to => [ "string", "array", "hash", "symbol", "boolean", "numeric" ], :default => "string" },
:required => { :equal_to => [ "required", "recommended", "optional", true, false ], :default => "optional" },
:recipes => { :kind_of => [ Array ], :default => [] },
:default => { :kind_of => [ String, Array, Hash, Symbol, Numeric, TrueClass, FalseClass ] }
}
)
options[:required] = remap_required_attribute(options[:required]) unless options[:required].nil?
validate_choice_array(options)
validate_calculated_default_rule(options)
validate_choice_default_rule(options)
@attributes[name] = options
@attributes[name]
end